From f951b3cfad62d4fc39617084f36e6bd2f423ca8e Mon Sep 17 00:00:00 2001 From: cojmeister Date: Wed, 23 Nov 2022 15:01:55 +0200 Subject: [PATCH 1/4] Wrote Function Types --- .gitignore | 3 + index.js | 474 +++++++++++++++++++++++++------------------ package.json | 12 +- src/index.ts | 307 ++++++++++++++++++++++++++++ tsconfig.json | 45 ++++ types/index.d.ts | 12 ++ types/index.d.ts.map | 1 + 7 files changed, 651 insertions(+), 203 deletions(-) create mode 100644 .gitignore create mode 100644 src/index.ts create mode 100644 tsconfig.json create mode 100644 types/index.d.ts create mode 100644 types/index.d.ts.map diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46096f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +package-lock.json +.DS_Store diff --git a/index.js b/index.js index 11dea33..9d65331 100644 --- a/index.js +++ b/index.js @@ -1,220 +1,290 @@ -var cp=require('child_process'); -var fs=require('fs'); -var path=require('path'); -var events=require('events'); -var zstdBin=(process.platform === 'win32')?((process.arch === 'x64')?'zstd64.exe':'zstd32.exe'):((process.platform === 'darwin')?'zstd.darwin':'zstd.linux64'); -var zstdBinPath=path.resolve(__dirname, 'bin', zstdBin); - -function compress(inputFile, outputFile, compLevel, callback){ - var args=[]; - for (var i=0; i0) compLevel=args.shift(); else compLevel=3; - if(inputFile === outputFile){ - if(callback) callback(new Error('Input and output files cannot be the same.')) - return; - } - if(compLevel<1 || compLevel>22) - compLevel=3; - fs.access(inputFile, fs.R_OK, (err) => { - if(err){ - if(callback) callback(new Error('Input file is not readable.')); - return; +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; } - fs.access(path.dirname(outputFile), fs.W_OK, (err) => { - if(err){ - if(callback) callback(new Error('Output file is not writable.')); - return; - } - fs.access(zstdBinPath, fs.R_OK | fs.X_OK, (err) => { - if(err){ - if(callback) callback(new Error('Zstd binary is not executable.')); - return; + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decompressFileToStream = exports.decompressionStreamFromFile = exports.decompress = exports.compressStreamToFile = exports.compress = void 0; +const cp = __importStar(require("child_process")); +const events_1 = __importDefault(require("events")); +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); +const zstdBin = process.platform === "win32" + ? process.arch === "x64" + ? "zstd64.exe" + : "zstd32.exe" + : process.platform === "darwin" + ? "zstd.darwin" + : "zstd.linux64"; +const zstdBinPath = path.resolve(__dirname, "bin", zstdBin); +function compress(inputFile, outputFile, compLevel = 3, callback) { + inputFile = path.resolve(inputFile); + outputFile = path.resolve(outputFile); + if (inputFile === outputFile) { + if (callback != undefined) { + callback(new Error("Input and output files cannot be the same.")); } - cp.execFile(zstdBinPath, ['-f', '-'+compLevel, inputFile, '-o', outputFile] - , (err, stdout, stderr) => { - - if(err){ - if(callback) callback(err); - return; - } else if(stdout){ - if(callback) callback(new Error(stdout)); + return; + } + if (compLevel < 1 || compLevel > 22) { + compLevel = 3; + } + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) + callback(new Error("Input file is not readable.")); return; - } - if(callback) callback(null, outputFile); + } + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) + callback(new Error("Output file is not writable.")); + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) + callback(new Error("Zstd binary is not executable.")); + return; + } + cp.execFile(zstdBinPath, ["-f", "-" + compLevel, inputFile, "-o", outputFile], (err, stdout, _) => { + if (err) { + if (callback) + callback(err); + return; + } + else if (stdout) { + if (callback) + callback(new Error(stdout)); + return; + } + if (callback) + callback(null, outputFile); + }); + }); }); - }); }); - }); } - -function compressStreamToFile(readableStream, outputFile, compLevel, callback){ - var args=[]; - for (var i=0; i0) compLevel=args.shift(); else compLevel=3; - if(compLevel<1 || compLevel>22) - compLevel=3; - var eventEmitter = new events.EventEmitter(); - fs.access(path.dirname(outputFile), fs.W_OK, (err) => { - if(err){ - if(callback) callback(new Error('Output file is not writable.')); - return; +exports.compress = compress; +function compressStreamToFile(readableStream, outputFile, compLevel = 3, callback) { + if (compLevel < 1 || compLevel > 22) { + compLevel = 3; } - fs.access(zstdBinPath, fs.R_OK | fs.X_OK, (err) => { - if(err){ - if(callback) callback(new Error('Zstd binary is not executable.')); - return; - } - var proc=cp.spawn(zstdBinPath, ['-f', '-o', outputFile]); - readableStream.pipe(proc.stdin); - readableStream.on('error', (err) => { - proc.kill(); - eventEmitter.emit('error', err); - }); - proc.on('exit', (code, signal) => { - if(code==0) eventEmitter.emit('end'); - else if(code!=0) eventEmitter.emit('error', new Error('Unexpected stream close. Code '+code+'. Signal '+signal)); - proc.removeAllListeners('error'); - }); - proc.on('error', (err) => { - eventEmitter.emit('error', err); - proc.removeAllListeners('exit'); - }); - if(callback) callback(null, eventEmitter); + const eventEmitter = new events_1.default.EventEmitter(); + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Output file is not writable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + const proc = cp.spawn(zstdBinPath, ["-f", "-o", outputFile]); + readableStream.pipe(proc.stdin); + readableStream.on("error", (err) => { + proc.kill(); + eventEmitter.emit("error", err); + }); + proc.on("exit", (code, signal) => { + if (code == 0) { + eventEmitter.emit("end"); + } + else if (code != 0) { + eventEmitter.emit("error", new Error("Unexpected stream close. Code " + code + ". Signal " + signal)); + } + proc.removeAllListeners("error"); + }); + proc.on("error", (err) => { + eventEmitter.emit("error", err); + proc.removeAllListeners("exit"); + }); + if (callback) { + callback(null, eventEmitter); + } + }); }); - }); } - -function decompress(inputFile, outputFile, callback){ - inputFile=path.resolve(inputFile); - outputFile=path.resolve(outputFile); - if(inputFile === outputFile){ - if(callback) callback(new Error('Input and output files cannot be the same.')) - return; - } - fs.access(inputFile, fs.R_OK, (err) => { - if(err){ - if(callback) callback(new Error('Input file is not readable.')); - return; - } - fs.access(path.dirname(outputFile), fs.W_OK, (err) => { - if(err){ - if(callback) callback(new Error('Output file is not writable.')); - return; - } - fs.access(zstdBinPath, fs.R_OK | fs.X_OK, (err) => { - if(err){ - if(callback) callback(new Error('Zstd binary is not executable.')); - return; +exports.compressStreamToFile = compressStreamToFile; +function decompress(inputFile, outputFile, callback) { + inputFile = path.resolve(inputFile); + outputFile = path.resolve(outputFile); + if (inputFile === outputFile) { + if (callback) { + callback(new Error("Input and output files cannot be the same.")); } - cp.execFile(zstdBinPath, ['-f', '-d', inputFile, '-o', outputFile] - , (err, stdout, stderr) => { - if(err){ - if(callback) callback(err); - return; - } else if(stdout){ - if(callback) callback(new Error(stdout)); + return; + } + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Input file is not readable.")); + } return; - } - if(callback) callback(null, outputFile); + } + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Output file is not writable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + cp.execFile(zstdBinPath, ["-f", "-d", inputFile, "-o", outputFile], (err, stdout, _) => { + if (err) { + if (callback) { + callback(err); + } + return; + } + else if (stdout) { + if (callback) { + callback(new Error(stdout)); + } + return; + } + if (callback) { + callback(null, outputFile); + } + }); + }); }); - }); }); - }); } - -function decompressionStreamFromFile(inputFile, callback){ - inputFile=path.resolve(inputFile); - var eventEmitter = new events.EventEmitter(); - fs.access(inputFile, fs.R_OK, (err) => { - if(err){ - if(callback) callback(new Error('Input file is not readable.')); - return; - } - fs.access(zstdBinPath, fs.R_OK | fs.X_OK, (err) => { - if(err){ - if(callback) callback(new Error('Zstd binary is not executable.')); - return; - } - var proc=cp.spawn(zstdBinPath, ['-d', inputFile, '-c']); - proc.stdout.on('data', (data) => { - eventEmitter.emit('data', data); - }); - proc.once('exit', (code, signal) => { - if(code==0) eventEmitter.emit('end'); - else if(code==39) eventEmitter.emit('error', new Error('Not in zstd format')); - else eventEmitter.emit('error', new Error('Unexpected stream close. Code '+code+'. Signal'+signal)); - proc.stdout.removeAllListeners('data'); - proc.removeAllListeners('error'); - }); - proc.once('error', (err) => { - eventEmitter.emit('error', err); - proc.stdout.removeAllListeners('data'); - proc.removeAllListeners('exit'); - }); - if(callback) callback(null, eventEmitter); +exports.decompress = decompress; +function decompressionStreamFromFile(inputFile, callback) { + inputFile = path.resolve(inputFile); + const eventEmitter = new events_1.default.EventEmitter(); + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Input file is not readable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + const proc = cp.spawn(zstdBinPath, ["-d", inputFile, "-c"]); + proc.stdout.on("data", (data) => { + eventEmitter.emit("data", data); + }); + proc.once("exit", (code, signal) => { + if (code == 0) { + eventEmitter.emit("end"); + } + else if (code == 39) { + eventEmitter.emit("error", new Error("Not in zstd format")); + } + else { + eventEmitter.emit("error", new Error("Unexpected stream close. Code " + code + ". Signal" + signal)); + } + proc.stdout.removeAllListeners("data"); + proc.removeAllListeners("error"); + }); + proc.once("error", (err) => { + eventEmitter.emit("error", err); + proc.stdout.removeAllListeners("data"); + proc.removeAllListeners("exit"); + }); + if (callback) { + callback(null, eventEmitter); + } + }); }); - }); } - -function decompressFileToStream(inputFile, writableStream, callback){ - inputFile=path.resolve(inputFile); - var eventEmitter = new events.EventEmitter(); - fs.access(inputFile, fs.R_OK, (err) => { - if(err){ - if(callback) callback(new Error('Input file is not readable.')); - return; - } - fs.access(zstdBinPath, fs.R_OK | fs.X_OK, (err) => { - if(err){ - if(callback) callback(new Error('Zstd binary is not executable.')); - return; - } - var exitCode; - var finished=false; - var options=['-d', inputFile, '-c'] - var proc=cp.spawn(zstdBinPath, options); - proc.stdout.pipe(writableStream); - proc.on('exit', (code, signal) => { - if(code==39) eventEmitter.emit('error', new Error('Not in zstd format')); - else if(code!=0) eventEmitter.emit('error', new Error('Unexpected stream close. Code '+code+'. Signal '+signal)); - else exitCode=0; - if(finished) eventEmitter.emit('finish'); - proc.removeAllListeners('error'); - }); - proc.on('error', (err) => { - eventEmitter.emit('error', err); - proc.removeAllListeners('exit'); - }); - writableStream.on('error', (err) => { - eventEmitter.emit('error', err); - proc.kill(); - writableStream.removeAllListeners('finish'); - }); - writableStream.on('finish', () => { - finished=true; - if(exitCode==0) eventEmitter.emit('finish'); - writableStream.removeAllListeners('error'); - }); - if(callback) callback(null, eventEmitter); +exports.decompressionStreamFromFile = decompressionStreamFromFile; +function decompressFileToStream(inputFile, writableStream, callback) { + inputFile = path.resolve(inputFile); + const eventEmitter = new events_1.default.EventEmitter(); + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) + callback(new Error("Input file is not readable.")); + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) + callback(new Error("Zstd binary is not executable.")); + return; + } + let exitCode; + let finished = false; + const options = ["-d", inputFile, "-c"]; + const proc = cp.spawn(zstdBinPath, options); + proc.stdout.pipe(writableStream); + proc.on("exit", (code, signal) => { + if (code == 39) { + eventEmitter.emit("error", new Error("Not in zstd format")); + } + else if (code != 0) { + eventEmitter.emit("error", new Error("Unexpected stream close. Code " + code + ". Signal " + signal)); + } + else + exitCode = 0; + if (finished) { + eventEmitter.emit("finish"); + } + proc.removeAllListeners("error"); + }); + proc.on("error", (err) => { + eventEmitter.emit("error", err); + proc.removeAllListeners("exit"); + }); + writableStream.on("error", (err) => { + eventEmitter.emit("error", err); + proc.kill(); + writableStream.removeAllListeners("finish"); + }); + writableStream.on("finish", () => { + finished = true; + if (exitCode == 0) { + eventEmitter.emit("finish"); + } + writableStream.removeAllListeners("error"); + }); + if (callback) { + callback(null, eventEmitter); + } + }); }); - }); } - -module.exports.compress=compress; -module.exports.compressFileToFile=compress; -module.exports.compressStreamToFile=compressStreamToFile; - -module.exports.decompress=decompress; -module.exports.decompressFileToFile=decompress; -module.exports.decompressionStreamFromFile=decompressionStreamFromFile; -module.exports.decompressFileToStream=decompressFileToStream; \ No newline at end of file +exports.decompressFileToStream = decompressFileToStream; diff --git a/package.json b/package.json index b127cda..7603db5 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.2.4", "description": "Node.js interface to Zstandard (zstd)", "main": "index.js", + "types": "./types/index.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, @@ -19,5 +20,14 @@ "bugs": { "url": "https://github.com/albertdb/node-zstandard/issues" }, - "homepage": "https://github.com/albertdb/node-zstandard#readme" + "homepage": "https://github.com/albertdb/node-zstandard#readme", + "devDependencies": { + "@types/node": "^18.11.9", + "typescript": "^4.9.3" + }, + "files": [ + "./index.js", + "./types/*", + "./bin/*" + ] } diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..6536e0c --- /dev/null +++ b/src/index.ts @@ -0,0 +1,307 @@ +import * as cp from "child_process"; +import { default as EventEmitter, default as events } from "events"; +import * as fs from "fs"; +import * as path from "path"; + +const zstdBin: string = + process.platform === "win32" + ? process.arch === "x64" + ? "zstd64.exe" + : "zstd32.exe" + : process.platform === "darwin" + ? "zstd.darwin" + : "zstd.linux64"; + +const zstdBinPath: string = path.resolve(__dirname, "bin", zstdBin); + +type CallbackFunction = ( + err: Error | null, + res?: string | EventEmitter +) => any | void; + +export function compress( + inputFile: string, + outputFile: string, + compLevel: number = 3, + callback?: CallbackFunction +): void { + inputFile = path.resolve(inputFile); + outputFile = path.resolve(outputFile); + + if (inputFile === outputFile) { + if (callback != undefined) { + callback(new Error("Input and output files cannot be the same.")); + } + return; + } + if (compLevel < 1 || compLevel > 22) { + compLevel = 3; + } + + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) callback(new Error("Input file is not readable.")); + return; + } + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) callback(new Error("Output file is not writable.")); + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) callback(new Error("Zstd binary is not executable.")); + return; + } + cp.execFile( + zstdBinPath, + ["-f", "-" + compLevel, inputFile, "-o", outputFile], + (err, stdout, _) => { + if (err) { + if (callback) callback(err); + return; + } else if (stdout) { + if (callback) callback(new Error(stdout)); + return; + } + if (callback) callback(null, outputFile); + } + ); + }); + }); + }); +} + +export function compressStreamToFile( + readableStream: fs.ReadStream, + outputFile: string, + compLevel: number = 3, + callback?: CallbackFunction +): void { + if (compLevel < 1 || compLevel > 22) { + compLevel = 3; + } + const eventEmitter = new events.EventEmitter(); + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Output file is not writable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + const proc = cp.spawn(zstdBinPath, ["-f", "-o", outputFile]); + readableStream.pipe(proc.stdin); + readableStream.on("error", (err) => { + proc.kill(); + eventEmitter.emit("error", err); + }); + proc.on("exit", (code, signal) => { + if (code == 0) { + eventEmitter.emit("end"); + } else if (code != 0) { + eventEmitter.emit( + "error", + new Error( + "Unexpected stream close. Code " + code + ". Signal " + signal + ) + ); + } + proc.removeAllListeners("error"); + }); + proc.on("error", (err) => { + eventEmitter.emit("error", err); + proc.removeAllListeners("exit"); + }); + if (callback) { + callback(null, eventEmitter); + } + }); + }); +} + +export function decompress( + inputFile: string, + outputFile: string, + callback?: CallbackFunction +): void { + inputFile = path.resolve(inputFile); + outputFile = path.resolve(outputFile); + if (inputFile === outputFile) { + if (callback) { + callback(new Error("Input and output files cannot be the same.")); + } + return; + } + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Input file is not readable.")); + } + return; + } + fs.access(path.dirname(outputFile), fs.constants.W_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Output file is not writable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + cp.execFile( + zstdBinPath, + ["-f", "-d", inputFile, "-o", outputFile], + (err, stdout, _) => { + if (err) { + if (callback) { + callback(err); + } + return; + } else if (stdout) { + if (callback) { + callback(new Error(stdout)); + } + return; + } + if (callback) { + callback(null, outputFile); + } + } + ); + }); + }); + }); +} + +export function decompressionStreamFromFile( + inputFile: string, + callback?: CallbackFunction +): void { + inputFile = path.resolve(inputFile); + const eventEmitter = new events.EventEmitter(); + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Input file is not readable.")); + } + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } + return; + } + const proc = cp.spawn(zstdBinPath, ["-d", inputFile, "-c"]); + proc.stdout.on("data", (data) => { + eventEmitter.emit("data", data); + }); + + proc.once("exit", (code, signal) => { + if (code == 0) { + eventEmitter.emit("end"); + } else if (code == 39) { + eventEmitter.emit("error", new Error("Not in zstd format")); + } else { + eventEmitter.emit( + "error", + new Error( + "Unexpected stream close. Code " + code + ". Signal" + signal + ) + ); + } + proc.stdout.removeAllListeners("data"); + proc.removeAllListeners("error"); + }); + + proc.once("error", (err) => { + eventEmitter.emit("error", err); + proc.stdout.removeAllListeners("data"); + proc.removeAllListeners("exit"); + }); + + if (callback) { + callback(null, eventEmitter); + } + }); + }); +} + +export function decompressFileToStream( + inputFile: string, + writableStream: fs.WriteStream, + callback?: CallbackFunction +): void { + inputFile = path.resolve(inputFile); + const eventEmitter = new events.EventEmitter(); + fs.access(inputFile, fs.constants.R_OK, (err) => { + if (err) { + if (callback) callback(new Error("Input file is not readable.")); + return; + } + fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { + if (err) { + if (callback) callback(new Error("Zstd binary is not executable.")); + return; + } + + let exitCode: number; + let finished: boolean = false; + + const options: string[] = ["-d", inputFile, "-c"]; + + const proc = cp.spawn(zstdBinPath, options); + + proc.stdout.pipe(writableStream); + + proc.on("exit", (code, signal) => { + if (code == 39) { + eventEmitter.emit("error", new Error("Not in zstd format")); + } else if (code != 0) { + eventEmitter.emit( + "error", + new Error( + "Unexpected stream close. Code " + code + ". Signal " + signal + ) + ); + } else exitCode = 0; + if (finished) { + eventEmitter.emit("finish"); + } + proc.removeAllListeners("error"); + }); + proc.on("error", (err) => { + eventEmitter.emit("error", err); + proc.removeAllListeners("exit"); + }); + writableStream.on("error", (err) => { + eventEmitter.emit("error", err); + proc.kill(); + writableStream.removeAllListeners("finish"); + }); + writableStream.on("finish", () => { + finished = true; + if (exitCode == 0) { + eventEmitter.emit("finish"); + } + writableStream.removeAllListeners("error"); + }); + if (callback) { + callback(null, eventEmitter); + } + }); + }); +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..f9bc020 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,45 @@ +{ "files": ["./src/index.ts"], + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["es6"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": "src", /* Specify the root folder within your source files. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + + /* Emit */ + "outDir": "./", /* Specify an output folder for all emitted files. */ + + /* Additional Checks */ + "noUnusedLocals": true, /* Report errors on unused locals. */ + "noUnusedParameters": true, /* Report errors on unused parameters. */ + "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "allowUnreachableCode": false, /* Disable error reporting for unreachable code. */ + + "declaration": true, + "declarationDir": "./types", + "declarationMap": true, + + /* Completeness */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..43f246b --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,12 @@ +/// +/// +import { default as EventEmitter } from "events"; +import * as fs from "fs"; +type CallbackFunction = (err: Error | null, res?: string | EventEmitter) => any | void; +export declare function compress(inputFile: string, outputFile: string, compLevel?: number, callback?: CallbackFunction): void; +export declare function compressStreamToFile(readableStream: fs.ReadStream, outputFile: string, compLevel?: number, callback?: CallbackFunction): void; +export declare function decompress(inputFile: string, outputFile: string, callback?: CallbackFunction): void; +export declare function decompressionStreamFromFile(inputFile: string, callback?: CallbackFunction): void; +export declare function decompressFileToStream(inputFile: string, writableStream: fs.WriteStream, callback?: CallbackFunction): void; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/index.d.ts.map b/types/index.d.ts.map new file mode 100644 index 0000000..c30e1c1 --- /dev/null +++ b/types/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAqB,MAAM,QAAQ,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAczB,KAAK,gBAAgB,GAAG,CACtB,GAAG,EAAE,KAAK,GAAG,IAAI,EACjB,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,KACxB,GAAG,GAAG,IAAI,CAAC;AAEhB,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA8CN;AAED,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,EAAE,CAAC,UAAU,EAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA+CN;AAED,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAqDN;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAkDN;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,EAAE,CAAC,WAAW,EAC9B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA4DN"} \ No newline at end of file From 5632383d13e073d6df2998244b0d35fc5d3ba656 Mon Sep 17 00:00:00 2001 From: cojmeister Date: Wed, 23 Nov 2022 15:38:26 +0200 Subject: [PATCH 2/4] Added documentation --- index.js | 50 ++++++++++++++++++++++++++++++++++++++++-- src/index.ts | 52 ++++++++++++++++++++++++++++++++++++++++++-- types/index.d.ts | 44 +++++++++++++++++++++++++++++++++++++ types/index.d.ts.map | 2 +- 4 files changed, 143 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 9d65331..e0be7fa 100644 --- a/index.js +++ b/index.js @@ -39,6 +39,14 @@ const zstdBin = process.platform === "win32" ? "zstd.darwin" : "zstd.linux64"; const zstdBinPath = path.resolve(__dirname, "bin", zstdBin); +/** + * Compress inputFile by compLevel to outputFile using zstd + * @param {string} inputFile Path to the to file to be compressed - can be relative or absolute + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ function compress(inputFile, outputFile, compLevel = 3, callback) { inputFile = path.resolve(inputFile); outputFile = path.resolve(outputFile); @@ -88,6 +96,16 @@ function compress(inputFile, outputFile, compLevel = 3, callback) { }); } exports.compress = compress; +/** + * Compress stream by compLevel to outputFile using zstd + * @param {fs.ReadStream} readableStream Data Node.js Stream to be compressed. + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute. Output file is overwritten if it exists. + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error reading the stream or creating the compressed file occurred. Error message is provided. + * - end: Emitted when task ended successfully. + * @returns {void}None + */ function compressStreamToFile(readableStream, outputFile, compLevel = 3, callback) { if (compLevel < 1 || compLevel > 22) { compLevel = 3; @@ -133,6 +151,14 @@ function compressStreamToFile(readableStream, outputFile, compLevel = 3, callbac }); } exports.compressStreamToFile = compressStreamToFile; +/** + * Decompress inputFile to outputFile using zstd - call callback function upon completion + * * NOTE: Input and output files should be different. Output file is overwritten if it exists. + * @param {string} inputFile Path to the to compressed input file. + * @param {string} outputFile Path to store the resulting decompressed file. + * @param {CallbackFunction} [callback] Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ function decompress(inputFile, outputFile, callback) { inputFile = path.resolve(inputFile); outputFile = path.resolve(outputFile); @@ -185,6 +211,15 @@ function decompress(inputFile, outputFile, callback) { }); } exports.decompress = decompress; +/** + * Decompress inputFile to stream on callback using zstd + * @param {string} inputFile Path to the to compressed input file. + * @param {CallbackFunction} [callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - data: Emitted when a chunk of decompressed data is generated. Data is obviously provided. + * - end: Emitted when decompression ended and all data events have been emitted. + * @returns {void}None + */ function decompressionStreamFromFile(inputFile, callback) { inputFile = path.resolve(inputFile); const eventEmitter = new events_1.default.EventEmitter(); @@ -231,19 +266,30 @@ function decompressionStreamFromFile(inputFile, callback) { }); } exports.decompressionStreamFromFile = decompressionStreamFromFile; +/** + * Decompress inputFile to stream using zstd - get output on callback with eventEmitter + * @param {string}inputFile Path to the to compressed input file. + * @param {fs.WriteStream}writableStream Node.js Stream where to output decompressed data. + * @param {CallbackFunction}[callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - finish: Emitted when finished writting decompressed data to output stream. + * @returns {void}None + */ function decompressFileToStream(inputFile, writableStream, callback) { inputFile = path.resolve(inputFile); const eventEmitter = new events_1.default.EventEmitter(); fs.access(inputFile, fs.constants.R_OK, (err) => { if (err) { - if (callback) + if (callback) { callback(new Error("Input file is not readable.")); + } return; } fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { if (err) { - if (callback) + if (callback) { callback(new Error("Zstd binary is not executable.")); + } return; } let exitCode; diff --git a/src/index.ts b/src/index.ts index 6536e0c..0538f29 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,14 @@ type CallbackFunction = ( res?: string | EventEmitter ) => any | void; +/** + * Compress inputFile by compLevel to outputFile using zstd + * @param {string} inputFile Path to the to file to be compressed - can be relative or absolute + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ export function compress( inputFile: string, outputFile: string, @@ -72,6 +80,16 @@ export function compress( }); } +/** + * Compress stream by compLevel to outputFile using zstd + * @param {fs.ReadStream} readableStream Data Node.js Stream to be compressed. + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute. Output file is overwritten if it exists. + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error reading the stream or creating the compressed file occurred. Error message is provided. + * - end: Emitted when task ended successfully. + * @returns {void}None + */ export function compressStreamToFile( readableStream: fs.ReadStream, outputFile: string, @@ -126,6 +144,14 @@ export function compressStreamToFile( }); } +/** + * Decompress inputFile to outputFile using zstd - call callback function upon completion + * * NOTE: Input and output files should be different. Output file is overwritten if it exists. + * @param {string} inputFile Path to the to compressed input file. + * @param {string} outputFile Path to store the resulting decompressed file. + * @param {CallbackFunction} [callback] Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ export function decompress( inputFile: string, outputFile: string, @@ -185,6 +211,15 @@ export function decompress( }); } +/** + * Decompress inputFile to stream on callback using zstd + * @param {string} inputFile Path to the to compressed input file. + * @param {CallbackFunction} [callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - data: Emitted when a chunk of decompressed data is generated. Data is obviously provided. + * - end: Emitted when decompression ended and all data events have been emitted. + * @returns {void}None + */ export function decompressionStreamFromFile( inputFile: string, callback?: CallbackFunction @@ -240,6 +275,15 @@ export function decompressionStreamFromFile( }); } +/** + * Decompress inputFile to stream using zstd - get output on callback with eventEmitter + * @param {string}inputFile Path to the to compressed input file. + * @param {fs.WriteStream}writableStream Node.js Stream where to output decompressed data. + * @param {CallbackFunction}[callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - finish: Emitted when finished writting decompressed data to output stream. + * @returns {void}None + */ export function decompressFileToStream( inputFile: string, writableStream: fs.WriteStream, @@ -249,12 +293,16 @@ export function decompressFileToStream( const eventEmitter = new events.EventEmitter(); fs.access(inputFile, fs.constants.R_OK, (err) => { if (err) { - if (callback) callback(new Error("Input file is not readable.")); + if (callback) { + callback(new Error("Input file is not readable.")); + } return; } fs.access(zstdBinPath, fs.constants.R_OK | fs.constants.X_OK, (err) => { if (err) { - if (callback) callback(new Error("Zstd binary is not executable.")); + if (callback) { + callback(new Error("Zstd binary is not executable.")); + } return; } diff --git a/types/index.d.ts b/types/index.d.ts index 43f246b..1bd651b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -3,10 +3,54 @@ import { default as EventEmitter } from "events"; import * as fs from "fs"; type CallbackFunction = (err: Error | null, res?: string | EventEmitter) => any | void; +/** + * Compress inputFile by compLevel to outputFile using zstd + * @param {string} inputFile Path to the to file to be compressed - can be relative or absolute + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ export declare function compress(inputFile: string, outputFile: string, compLevel?: number, callback?: CallbackFunction): void; +/** + * Compress stream by compLevel to outputFile using zstd + * @param {fs.ReadStream} readableStream Data Node.js Stream to be compressed. + * @param {string} outputFile Path to store the resulting compressed file - can be relative or absolute. Output file is overwritten if it exists. + * @param {number} [compLevel=3] Compression - int between 1 and 22; [default=3] + * @param {CallbackFunction} [callback] Optional Callback Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error reading the stream or creating the compressed file occurred. Error message is provided. + * - end: Emitted when task ended successfully. + * @returns {void}None + */ export declare function compressStreamToFile(readableStream: fs.ReadStream, outputFile: string, compLevel?: number, callback?: CallbackFunction): void; +/** + * Decompress inputFile to outputFile using zstd - call callback function upon completion + * * NOTE: Input and output files should be different. Output file is overwritten if it exists. + * @param {string} inputFile Path to the to compressed input file. + * @param {string} outputFile Path to store the resulting decompressed file. + * @param {CallbackFunction} [callback] Function to be executed on task completion. Follows Node.js (err, result) pattern, being result equal to outputFile when succeeded. + * @returns {void}None + */ export declare function decompress(inputFile: string, outputFile: string, callback?: CallbackFunction): void; +/** + * Decompress inputFile to stream on callback using zstd + * @param {string} inputFile Path to the to compressed input file. + * @param {CallbackFunction} [callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - data: Emitted when a chunk of decompressed data is generated. Data is obviously provided. + * - end: Emitted when decompression ended and all data events have been emitted. + * @returns {void}None + */ export declare function decompressionStreamFromFile(inputFile: string, callback?: CallbackFunction): void; +/** + * Decompress inputFile to stream using zstd - get output on callback with eventEmitter + * @param {string}inputFile Path to the to compressed input file. + * @param {fs.WriteStream}writableStream Node.js Stream where to output decompressed data. + * @param {CallbackFunction}[callback] Function to be executed on task initialization. Follows Node.js (err, result) pattern, being result an EventEmitter that can emit the following events: + * - error: Emitted when an error involving streams or file decompression occurred. Error message is provided. + * - finish: Emitted when finished writting decompressed data to output stream. + * @returns {void}None + */ export declare function decompressFileToStream(inputFile: string, writableStream: fs.WriteStream, callback?: CallbackFunction): void; export {}; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/types/index.d.ts.map b/types/index.d.ts.map index c30e1c1..c0d767f 100644 --- a/types/index.d.ts.map +++ b/types/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAqB,MAAM,QAAQ,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAczB,KAAK,gBAAgB,GAAG,CACtB,GAAG,EAAE,KAAK,GAAG,IAAI,EACjB,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,KACxB,GAAG,GAAG,IAAI,CAAC;AAEhB,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA8CN;AAED,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,EAAE,CAAC,UAAU,EAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA+CN;AAED,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAqDN;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAkDN;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,EAAE,CAAC,WAAW,EAC9B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA4DN"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAqB,MAAM,QAAQ,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAczB,KAAK,gBAAgB,GAAG,CACtB,GAAG,EAAE,KAAK,GAAG,IAAI,EACjB,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,KACxB,GAAG,GAAG,IAAI,CAAC;AAEhB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA8CN;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,EAAE,CAAC,UAAU,EAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAU,EACrB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CA+CN;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAqDN;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAkDN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,EAAE,CAAC,WAAW,EAC9B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,IAAI,CAgEN"} \ No newline at end of file From 596ffcffb40e42c3c4f1f08593c3d1c36df5ef19 Mon Sep 17 00:00:00 2001 From: cojmeister Date: Wed, 23 Nov 2022 16:32:57 +0200 Subject: [PATCH 3/4] Added jsdoc --- .gitignore | 1 + jsdoc.json | 18 ++++++++++++++++++ package.json | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 jsdoc.json diff --git a/.gitignore b/.gitignore index 46096f2..1247386 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules package-lock.json .DS_Store +jsdoc/ \ No newline at end of file diff --git a/jsdoc.json b/jsdoc.json new file mode 100644 index 0000000..476261e --- /dev/null +++ b/jsdoc.json @@ -0,0 +1,18 @@ +{ + "plugins": ["plugins/markdown"], + "recurseDepth": 10, + "source": { + "include": ["./"], + "includePattern": ".js$", + "excludePattern": "(node_modules/|docs)" + }, + "templates": { + "cleverLinks": true, + "monospaceLinks": true + }, + "opts": { + "destination": "./jsdoc", + "recurse": true, + "readme": "./readme.md" + } +} diff --git a/package.json b/package.json index 7603db5..481020b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "types": "./types/index.d.ts", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "jsdoc": "jsdoc -c jsdoc.json" }, "repository": { "type": "git", @@ -23,6 +24,7 @@ "homepage": "https://github.com/albertdb/node-zstandard#readme", "devDependencies": { "@types/node": "^18.11.9", + "jsdoc": "^4.0.0", "typescript": "^4.9.3" }, "files": [ From 252e73578ff90cea28f717ab10ec057d19fdfb43 Mon Sep 17 00:00:00 2001 From: cojmeister Date: Sat, 26 Nov 2022 20:27:14 +0200 Subject: [PATCH 4/4] 1.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 481020b..d06f67b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-zstandard", - "version": "1.2.4", + "version": "1.3.0", "description": "Node.js interface to Zstandard (zstd)", "main": "index.js", "types": "./types/index.d.ts",