New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

addon-tools-raub

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

addon-tools-raub - npm Package Compare versions

Comparing version 5.2.1 to 5.3.0

cpbin.d.ts

4

cpbin.js

@@ -8,6 +8,5 @@ 'use strict';

module.exports = async name => {
const srcDir = process.cwd().replace(/\\/g, '/');
if ( ! await exists(`${srcDir}/build/Release/${name}.node`) ) {
if (!await exists(`${srcDir}/build/Release/${name}.node`) ) {
console.error(`Error. File "${srcDir}/build/Release/${name}.node" not found.`);

@@ -31,3 +30,2 @@ }

console.log(`The binary "${name}.node" was copied to "${bin}".`);
};
'use strict';
const napi = require('node-addon-api');
const platformNames = {

@@ -19,3 +22,3 @@ win32 : 'windows',

const napiInclude = require('node-addon-api').include.replace(/\\/g, '/');
const napiInclude = napi.include.replace(/\\/g, '/');
const thisInclude = `${rootPath}/include`;

@@ -26,3 +29,2 @@ const includePath = `${napiInclude} ${thisInclude}`;

const paths = dir => {
dir = dir.replace(/\\/g, '/');

@@ -38,3 +40,2 @@

return { bin, include };
};

@@ -44,9 +45,6 @@

module.exports = {
paths,
bin : `bin-${platformName}`,
platform : platformName,
include : includePath,
};
{
"author": "Luis Blanco <luisblanco1337@gmail.com>",
"name": "addon-tools-raub",
"version": "5.2.1",
"version": "5.3.0",
"description": "Helpers for Node.js addons and dependency packages",

@@ -22,8 +22,14 @@ "license": "MIT",

"include",
"cpbin.js",
"cpbin.d.ts",
"download.js",
"cpbin.js",
"download.d.ts",
"index.js",
"index.d.ts",
"install.js",
"install.d.ts",
"utils.js",
"utils.d.ts",
"writable-buffer.js",
"writable-buffer.d.ts",
"LICENSE",

@@ -34,5 +40,11 @@ "package.json",

"engines": {
"node": ">=12.13.0",
"npm": ">=6.12.0"
"node": ">=14.16.0",
"npm": ">=6.14.1"
},
"scripts": {
"test": "cd test && npm run test && cd ..",
"test-ci": "cd test && npm run test-ci && cd ..",
"test-install": "cd test && npm ci && cd ..",
"test-coverage": "cd test && npm run coverage && cd .."
},
"repository": {

@@ -43,5 +55,5 @@ "type": "git",

"dependencies": {
"adm-zip": "0.4.16",
"node-addon-api": "3.0.0"
"adm-zip": "0.5.4",
"node-addon-api": "3.1.0"
}
}

@@ -6,7 +6,7 @@ # Addon Tools

[![NPM](https://nodei.co/npm/addon-tools-raub.png?compact=true)](https://www.npmjs.com/package/addon-tools-raub)
[![Build Status](https://api.travis-ci.com/node-3d/addon-tools-raub.svg?branch=master)](https://travis-ci.com/node-3d/addon-tools-raub)
[![CodeFactor](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub/badge)](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
> npm i addon-tools-raub
```
npm i addon-tools-raub
```

@@ -37,10 +37,21 @@

Main exports for cross-platform addon configuration.
* `paths(dir)` - function. Returns a set of platform dependent paths depending on
```
export const paths: (dir: string) => Readonly<{
bin: string;
include: string;
}>;
export const bin: string;
export const platform: string;
export const include: string;
```
* `paths` - Returns a set of platform dependent paths depending on
input `dir`.
* `bin` - platform binary directory absolute path.
* `include` - include directory for this `dir`.
* `bin` - platform-dependent binary directory name.
* `platform` - platform name: `'windows', 'linux', 'osx'`.
* `include` - both `'addon-tools-raub'` and `'node-addon-api'` include paths.
Use with `node -p` through list context command expansion `<!@(...)`.
* `bin` - platform-dependent binary directory name.
* `platform` - platform name: `'windows', 'linux', 'osx'`.

@@ -51,7 +62,14 @@

Downloads a file into the memory, **HTTP** or **HTTPS**.
`async WritableBuffer download(string url)` - accepts an **URL**, and
returns an in-memory buffer, when file is loaded.
Example use:
```
declare const download: (url: string) => Promise<Buffer>;
export default download;
```
Accepts an **URL**, and returns an in-memory file Buffer,
when the file is loaded. Use for small files, as the whole
file will be loaded into memory at once.
Example:
```
download(srcUrl).then(

@@ -69,3 +87,9 @@ data => useData(data),

Copies the addon binary from **src/build/Release** to the platform folder.
Copies the addon binary from `src/build/Release` to the platform folder.
```
declare const cpbin: (name: string) => Promise<void>;
export default cpbin;
```
It is useful for development builds. Use it in your **src/package.json**:

@@ -83,2 +107,8 @@ ```

Downloads and unzips the platform specific binary for the calling package.
```
declare const install: (folder: string) => void;
export default install;
```
To use it, create a new script for your package, which may as well be named

@@ -118,2 +148,10 @@ **install.js**, with the following content:

```
import type { Writable } from 'stream';
export class WritableBuffer extends Writable {
constructor();
get(): Buffer;
};
```
Use `stream.get()` to obtain the data when writing was finished:

@@ -130,2 +168,26 @@ ```

Async `fs` based helpers for common addon-related file operations.
```
import type { Stats } from 'fs';
export const read: (name: string) => Promise<string>;
export const write: (name: string, text: string) => Promise<void>;
export const copy: (src: string, dest: string) => Promise<void>;
export const exists: (name: string) => Promise<boolean>;
export const mkdir: (name: string) => Promise<void>;
export const stat: (name: string) => Promise<Stats>;
export const isDir: (name: string) => Promise<boolean>;
export const isFile: (name: string) => Promise<boolean>;
export const dirUp: (dir: string) => string;
export const ensuredir: (dir: string) => Promise<void>;
export const copysafe: (src: string, dest: string) => Promise<void>;
export const readdir: (src: string, dest: string) => Promise<ReadonlyArray<string>>;
export const subdirs: (name: string) => Promise<ReadonlyArray<string>>;
export const subfiles: (name: string) => Promise<ReadonlyArray<string>>;
export const traverse: (name: string, showDirs?: boolean) => Promise<ReadonlyArray<string>>;
export const copyall: (src: string, dest: string) => Promise<void>;
export const rmdir: (name: string) => Promise<void>;
export const rm: (name: string) => Promise<void>;
```
* `read` - (async) Reads a whole file to string, NOT A Buffer.

@@ -132,0 +194,0 @@ * `write` - (async) Write a file.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc