Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

addon-tools-raub

Package Overview
Dependencies
Maintainers
1
Versions
51
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 6.0.2 to 6.1.0

4

cpbin.js

@@ -7,3 +7,3 @@ 'use strict';

module.exports = async name => {
module.exports = async (name) => {
const srcDir = process.cwd().replace(/\\/g, '/');

@@ -17,3 +17,3 @@

if ( ! await exists(binAbs) ) {
if (!await exists(binAbs)) {
await mkdir(binAbs);

@@ -20,0 +20,0 @@ }

@@ -19,4 +19,4 @@ 'use strict';

const response = await new Promise((res, rej) => {
const request = proto.get(url, response => res(response));
request.on('error', err => rej(err));
const request = proto.get(url, (response) => res(response));
request.on('error', (err) => rej(err));
});

@@ -42,3 +42,3 @@

return new Promise((res, rej) => {
response.on('error', err => rej(err));
response.on('error', (err) => rej(err));
response.on('end', () => res(stream.get()));

@@ -48,2 +48,2 @@ });

module.exports = url => download(url);
module.exports = (url) => download(url);

@@ -20,3 +20,3 @@ 'use strict';

if ( ! platformName ) {
if (!platformName) {
console.log(`Error: UNKNOWN PLATFORM "${process.platform}"`);

@@ -33,3 +33,3 @@ }

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

@@ -36,0 +36,0 @@

@@ -21,3 +21,3 @@ 'use strict';

const onError = msg => {
const onError = (msg) => {
console.error(msg);

@@ -35,6 +35,6 @@ process.exit(-1);

const response = await new Promise((res, rej) => {
const request = proto.get(url, response => res(response));
request.on('error', err => rej(err));
const request = proto.get(url, (response) => res(response));
request.on('error', (err) => rej(err));
});
response.on('error', err => { throw err; });
response.on('error', (err) => { throw err; });

@@ -60,3 +60,3 @@ // Handle redirects

const zipWriter = fs.createWriteStream(zipPath);
zipWriter.on('error', err => rej(err));
zipWriter.on('error', (err) => rej(err));
zipWriter.on('finish', () => res());

@@ -77,5 +77,5 @@ response.pipe(zipWriter);

module.exports = folder => {
module.exports = (folder) => {
const url = `${folder}/${platform}.zip`;
install(url).then();
};
{
"author": "Luis Blanco <luisblanco1337@gmail.com>",
"name": "addon-tools-raub",
"version": "6.0.2",
"version": "6.1.0",
"description": "Helpers for Node.js addons and dependency packages",

@@ -39,4 +39,4 @@ "license": "MIT",

"engines": {
"node": ">=16.17.0",
"npm": ">=8.15.0"
"node": ">=18.12.1",
"npm": ">=8.19.2"
},

@@ -82,3 +82,3 @@ "scripts": {

"eslint-plugin-node": "^11.1.0",
"eslint": "^8.28.0",
"eslint": "^8.29.0",
"jest": "^29.3.1",

@@ -85,0 +85,0 @@ "node-addon-api": "^5.0.0",

@@ -5,3 +5,3 @@ # Addon Tools

[![NPM](https://nodei.co/npm/addon-tools-raub.png?compact=true)](https://www.npmjs.com/package/addon-tools-raub)
[![NPM](https://badge.fury.io/js/addon-tools-raub.svg)](https://badge.fury.io/js/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)

@@ -8,0 +8,0 @@

@@ -6,3 +6,3 @@ 'use strict';

// (async) Reads a whole file to string, NOT A Buffer
const read = name => new Promise(
const read = (name) => new Promise(
(res, rej) => fs.readFile(

@@ -17,3 +17,3 @@ name,

const write = (name, text) => new Promise(
(res, rej) => fs.writeFile(name, text, err => (err ? rej(err) : res()))
(res, rej) => fs.writeFile(name, text, (err) => (err ? rej(err) : res()))
);

@@ -26,3 +26,3 @@

await new Promise(
(res, rej) => fs.copyFile(src, dest, err => (err ? rej(err) : res()))
(res, rej) => fs.copyFile(src, dest, (err) => (err ? rej(err) : res()))
);

@@ -38,7 +38,7 @@ } catch (e) {

// (async) Check if a file/folder exists
const exists = name => new Promise(
res => fs.access(
const exists = (name) => new Promise(
(res) => fs.access(
name,
fs.constants.F_OK,
err => res(err ? false : true)
(err) => res(err ? false : true)
)

@@ -49,3 +49,3 @@ );

// (async) Create an empty folder
const mkdir = async name => {
const mkdir = async (name) => {
if (await exists(name)) {

@@ -55,3 +55,3 @@ return;

return new Promise(
(res, rej) => fs.mkdir(name, err => (err ? rej(err) : res()))
(res, rej) => fs.mkdir(name, (err) => (err ? rej(err) : res()))
);

@@ -62,3 +62,3 @@ };

// (async) Get status on a file
const stat = name => new Promise(
const stat = (name) => new Promise(
(res, rej) => fs.stat(name, (err, stats) => (err ? rej(err) : res(stats)))

@@ -69,15 +69,15 @@ );

// (async) Check if the path is a folder
const isDir = async name => (await stat(name)).isDirectory();
const isDir = async (name) => (await stat(name)).isDirectory();
// (async) Check if the path is a file
const isFile = async name => (await stat(name)).isFile();
const isFile = async (name) => (await stat(name)).isFile();
// Cut the path one folder up
const dirUp = dir => dir.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
const dirUp = (dir) => dir.replace(/\\/g, '/').split('/').slice(0, -1).join('/');
// (async) Like `mkdir -p`, makes sure a directory exists
const ensuredir = async dir => {
const ensuredir = async (dir) => {
if (await exists(dir) && await isDir(dir)) {

@@ -99,3 +99,3 @@ return;

// (async) Get file/folder names of the 1st level
const readdir = name => new Promise(
const readdir = (name) => new Promise(
(res, rej) => fs.readdir(

@@ -109,5 +109,5 @@ name,

// (async) Get folder paths (concatenated with input) of the 1st level
const subdirs = async name => {
const subdirs = async (name) => {
const all = await readdir(name);
const mapped = await Promise.all(all.map(d => isDir(`${name}/${d}`)));
const mapped = await Promise.all(all.map((d) => isDir(`${name}/${d}`)));
return all.filter((_, i) => mapped[i]);

@@ -118,6 +118,6 @@ };

// (async) Get file paths (concatenated with input) of the 1st level
const subfiles = async name => {
const subfiles = async (name) => {
const all = await readdir(name);
const mapped = await Promise.all(all.map(d => isFile(`${name}/${d}`)));
return all.filter((_, i) => mapped[i]).map(f => `${name}/${f}`);
const mapped = await Promise.all(all.map((d) => isFile(`${name}/${d}`)));
return all.filter((_, i) => mapped[i]).map((f) => `${name}/${f}`);
};

@@ -135,3 +135,3 @@

dirs.push(dir);
(await subdirs(dir)).forEach(d => stack.push(`${dir}/${d}`));
(await subdirs(dir)).forEach((d) => stack.push(`${dir}/${d}`));
}

@@ -160,4 +160,4 @@ return (showDirs ? dirs : []).concat(

// (async) Like `rm -rf`, removes everything recursively
const rmdir = async name => {
if ( ! await exists(name) ) {
const rmdir = async (name) => {
if (!await exists(name)) {
return;

@@ -172,3 +172,3 @@ }

target,
err => (err ? rej(err) : res())
(err) => (err ? rej(err) : res())
)

@@ -181,8 +181,8 @@ );

// (async) Remove a file. Must be a file, not a folder. Just `fs.unlink`.
const rm = async name => {
if ( ! await exists(name) ) {
const rm = async (name) => {
if (!await exists(name)) {
return;
}
await new Promise(
(res, rej) => fs.unlink(name, err => (err ? rej(err) : res()))
(res, rej) => fs.unlink(name, (err) => (err ? rej(err) : res()))
);

@@ -189,0 +189,0 @@ };

@@ -5,2 +5,3 @@ 'use strict';

const CHUNK_SIZE = 1024;

@@ -12,5 +13,3 @@ const INITIAL_SIZE = 8 * CHUNK_SIZE;

class WritableBuffer extends Writable {
constructor() {
super();

@@ -20,8 +19,6 @@

this._size = 0;
}
get() {
if ( ! this._size ) {
if (!this._size) {
return null;

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

return data;
}

@@ -40,4 +36,3 @@

_increaseAsNeeded(incomingSize) {
if ( (this._buffer.length - this._size) >= incomingSize ) {
if ((this._buffer.length - this._size) >= incomingSize) {
return;

@@ -53,3 +48,2 @@ }

this._buffer = newBuffer;
}

@@ -59,3 +53,2 @@

_write(chunk, encoding, callback) {
this._increaseAsNeeded(chunk.length);

@@ -67,7 +60,5 @@

callback();
}
}
module.exports = WritableBuffer;

Sorry, the diff of this file is not supported yet

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