fs-gzip-blob-storage
Advanced tools
Comparing version 3.0.1 to 4.0.0
@@ -1,4 +0,3 @@ | ||
/// <reference types="node" /> | ||
import { Readable, Writable } from "stream"; | ||
import zlib from "zlib"; | ||
import { Readable, Writable } from "node:stream"; | ||
import zlib from "node:zlib"; | ||
import { FsBlobStorageCommitOptions, FsBlobStorageOptions, FsBlobStorageReadStreamOptions, FsBlobStorageRemoveOptions, FsBlobStorageWriteStreamOptions } from "fs-blob-storage"; | ||
@@ -5,0 +4,0 @@ export interface FsGzipBlobStorageOptions extends FsBlobStorageOptions { |
@@ -1,18 +0,12 @@ | ||
"use strict"; | ||
/// <reference types="node" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FsGzipBlobStorage = exports.DEFAULT_GZIP_EXT = exports.DEFAULT_PART = exports.DEFAULT_EXT = void 0; | ||
const tslib_1 = require("tslib"); | ||
const zlib_1 = tslib_1.__importDefault(require("zlib")); | ||
const pumpify_1 = tslib_1.__importDefault(require("pumpify")); | ||
const fs_blob_storage_1 = require("fs-blob-storage"); | ||
var fs_blob_storage_2 = require("fs-blob-storage"); | ||
Object.defineProperty(exports, "DEFAULT_EXT", { enumerable: true, get: function () { return fs_blob_storage_2.DEFAULT_EXT; } }); | ||
Object.defineProperty(exports, "DEFAULT_PART", { enumerable: true, get: function () { return fs_blob_storage_2.DEFAULT_PART; } }); | ||
exports.DEFAULT_GZIP_EXT = ".gz"; | ||
class FsGzipBlobStorage { | ||
import zlib from "node:zlib"; | ||
import Pumpify from "pumpify"; | ||
import { FsBlobStorage, DEFAULT_EXT, } from "fs-blob-storage"; | ||
export { DEFAULT_EXT, DEFAULT_PART } from "fs-blob-storage"; | ||
export const DEFAULT_GZIP_EXT = ".gz"; | ||
export class FsGzipBlobStorage { | ||
constructor(options = {}) { | ||
this.storage = new fs_blob_storage_1.FsBlobStorage(options); | ||
this.ext = options.ext !== undefined ? options.ext : fs_blob_storage_1.DEFAULT_EXT; | ||
this.gzipExt = options.gzipExt !== undefined ? options.gzipExt : exports.DEFAULT_GZIP_EXT; | ||
this.storage = new FsBlobStorage(options); | ||
this.ext = options.ext !== undefined ? options.ext : DEFAULT_EXT; | ||
this.gzipExt = options.gzipExt !== undefined ? options.gzipExt : DEFAULT_GZIP_EXT; | ||
this.gzipOptions = options.gzipOptions || {}; | ||
@@ -25,4 +19,4 @@ } | ||
const file = await this.storage.createWriteStream(key, newOptions); | ||
const gzip = zlib_1.default.createGzip(this.gzipOptions); | ||
return new pumpify_1.default(gzip, file); | ||
const gzip = zlib.createGzip(this.gzipOptions); | ||
return new Pumpify(gzip, file); | ||
} | ||
@@ -34,4 +28,4 @@ async createReadStream(key, options = {}) { | ||
const file = await this.storage.createReadStream(key, newOptions); | ||
const gunzip = zlib_1.default.createGunzip(this.gzipOptions); | ||
return new pumpify_1.default(file, gunzip); | ||
const gunzip = zlib.createGunzip(this.gzipOptions); | ||
return new Pumpify(file, gunzip); | ||
} | ||
@@ -51,4 +45,2 @@ commit(key, options = {}) { | ||
} | ||
exports.FsGzipBlobStorage = FsGzipBlobStorage; | ||
exports.default = FsGzipBlobStorage; | ||
//# sourceMappingURL=fs-gzip-blob-storage.js.map | ||
export default FsGzipBlobStorage; |
{ | ||
"name": "fs-gzip-blob-storage", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Blob storage on filesystem, with gzip, streams and promises API", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"default": "./lib/fs-gzip-blob-storage.js", | ||
"typings": "./lib/fs-gzip-blob-storage.d.ts" | ||
} | ||
}, | ||
"main": "lib/fs-gzip-blob-storage.js", | ||
@@ -24,39 +31,42 @@ "typings": "lib/fs-gzip-blob-storage.d.ts", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": ">=16.0.0" | ||
}, | ||
"dependencies": { | ||
"fs-blob-storage": "^3.1.0", | ||
"pumpify": "^2.0.1", | ||
"tslib": "^2.0.2" | ||
"fs-blob-storage": "^4.1.0", | ||
"pumpify": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.13", | ||
"@types/dirty-chai": "^2.0.2", | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.11.5", | ||
"@types/pumpify": "^1.4.1", | ||
"@typescript-eslint/eslint-plugin": "^4.4.0", | ||
"@typescript-eslint/eslint-plugin-tslint": "^4.4.0", | ||
"@typescript-eslint/parser": "^4.4.0", | ||
"chai": "^4.2.0", | ||
"changelog-parser": "^2.8.0", | ||
"coveralls": "^3.1.0", | ||
"cross-env": "^7.0.2", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "^7.10.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^30.6.3", | ||
"eslint-plugin-node": "^11.1.0", | ||
"markdownlint-cli": "^0.24.0", | ||
"mocha": "^8.1.3", | ||
"@eslint/js": "^9.5.0", | ||
"@tsconfig/node16": "^16.1.3", | ||
"@types/chai": "^4.3.16", | ||
"@types/chai-as-promised": "^7.1.8", | ||
"@types/core-js": "^2.5.8", | ||
"@types/dns-packet": "^5.6.5", | ||
"@types/eslint__js": "^8.42.3", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.14.7", | ||
"@types/pumpify": "^1.4.4", | ||
"@types/semver": "^7.5.8", | ||
"@types/wtfnode": "^0.7.3", | ||
"@typescript-eslint/parser": "^7.13.1", | ||
"c8": "^10.1.2", | ||
"chai": "^5.1.1", | ||
"chai-as-promised": "^8.0.0", | ||
"coveralls": "^3.1.1", | ||
"dns-packet": "^5.6.1", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"markdownlint-cli": "^0.41.0", | ||
"mocha": "^10.4.0", | ||
"mocha-steps": "^1.3.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.1.2", | ||
"promise-readable": "^6.0.0", | ||
"promise-writable": "^6.0.0", | ||
"shx": "^0.3.2", | ||
"stream.pipeline-shim": "^1.1.0", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.3" | ||
"prettier": "^3.3.2", | ||
"promise-readable": "^8.0.1", | ||
"promise-writable": "^8.0.0", | ||
"semver": "^7.6.2", | ||
"shx": "^0.3.4", | ||
"ts-node": "^10.9.2", | ||
"tslib": "^2.6.3", | ||
"typescript": "^5.5.2", | ||
"typescript-eslint": "^7.13.1", | ||
"wtfnode": "^0.9.2" | ||
}, | ||
@@ -72,6 +82,5 @@ "scripts": { | ||
"lint:tsc:test": "tsc --noEmit --pretty --project test", | ||
"lint:eslint": "eslint --ext .js,.ts .", | ||
"lint:eslint": "eslint .", | ||
"lint:prettier": "prettier --ignore-path .gitignore --list-different '**/*.{js,json,md,ts,yml}'", | ||
"lint:markdownlint": "markdownlint \"*.md\"", | ||
"postpublish": "node -e \"require(\\\"changelog-parser\\\")(\\\"CHANGELOG.md\\\").then(ch => console.log(ch.versions.filter(v => v.version === \\\"$npm_package_version\\\").map(v => \\\"v$npm_package_version\\n\\n\\\" + v.body).concat(\\\"Release v$npm_package_version\\\")[0]))\" | xargs -0 git tag v$npm_package_version -a -m && git push --tags", | ||
"prepack": "npm run compile", | ||
@@ -81,5 +90,7 @@ "prepublishOnly": "npm run test", | ||
"test": "npm run test:spec", | ||
"test:spec": "$NYC mocha \"test/*.ts\"", | ||
"test:coverage": "npm run clean:coverage && cross-env NYC=\"nyc --no-clean --reporter=lcov\" npm run test:spec && nyc report --reporter=text-summary --color" | ||
"test:spec": "mocha", | ||
"test:coverage": "npm run test:coverage:spec && npm run test:coverage:report", | ||
"test:coverage:spec": "c8 --no-clean --reporter=lcov npm run test:spec", | ||
"test:coverage:report": "c8 report --reporter=text-summary --color" | ||
} | ||
} |
@@ -5,7 +5,11 @@ # fs-gzip-blob-storage | ||
[![Build Status](https://secure.travis-ci.org/dex4er/js-fs-gzip-blob-storage.svg)](http://travis-ci.org/dex4er/js-fs-gzip-blob-storage) [![Coverage Status](https://coveralls.io/repos/github/dex4er/js-fs-gzip-blob-storage/badge.svg)](https://coveralls.io/github/dex4er/js-fs-gzip-blob-storage) [![npm](https://img.shields.io/npm/v/fs-gzip-blob-storage.svg)](https://www.npmjs.com/package/fs-gzip-blob-storage) | ||
[![GitHub](https://img.shields.io/github/v/release/dex4er/js-fs-gzip-blob-storage?display_name=tag&sort=semver)](https://github.com/dex4er/js-fs-gzip-blob-storage) | ||
[![CI](https://github.com/dex4er/js-fs-gzip-blob-storage/actions/workflows/ci.yaml/badge.svg)](https://github.com/dex4er/js-fs-gzip-blob-storage/actions/workflows/ci.yaml) | ||
[![Trunk Check](https://github.com/dex4er/js-fs-gzip-blob-storage/actions/workflows/trunk.yaml/badge.svg)](https://github.com/dex4er/js-fs-gzip-blob-storage/actions/workflows/trunk.yaml) | ||
[![Coverage Status](https://coveralls.io/repos/github/dex4er/js-fs-gzip-blob-storage/badge.svg)](https://coveralls.io/github/dex4er/js-fs-gzip-blob-storage) | ||
[![npm](https://img.shields.io/npm/v/fs-gzip-blob-storage.svg)](https://www.npmjs.com/package/fs-gzip-blob-storage) | ||
<!-- markdownlint-enable MD013 --> | ||
Blob storage on filesystem, with gzip, streams and promises API. | ||
Blob storage on a filesystem, with gzip, streams and promises API. | ||
@@ -17,3 +21,3 @@ This is a wrapper for | ||
This module requires ES6 with Node >= 10. | ||
This module requires ES6 with Node >= 16. | ||
@@ -35,11 +39,3 @@ ## Installation | ||
```js | ||
const {FsGzipBlobStorage} = require("fs-gzip-blob-storage") | ||
``` | ||
_Typescript:_ | ||
```ts | ||
import FsGzipBlobStorage from "fs-gzip-blob-storage" | ||
// or | ||
import {FsGzipBlobStorage} from "fs-gzip-blob-storage" | ||
``` | ||
@@ -93,11 +89,11 @@ | ||
- `ext` is a default extension added to file name for the object (optional, | ||
default: `this.ext`) | ||
- `part` is a extension added to file name which can be later commited | ||
- `ext` is a default extension added to the file name for the object | ||
(optional, default: `this.ext`) | ||
- `part` is a extension added to the file name which can be later committed | ||
(optional, default: `this.part`) | ||
Creates a writable stream for a new object in the storage. Object is gzipped and | ||
stored with the file name based on `key` and `ext` and `gzipExt` and `part`. | ||
Throws an error if has occurred and if the file already exists for exclusive | ||
mode. | ||
Creates a writable stream for a new object in the storage. The object is | ||
gzipped and stored with the file name based on `key` and `ext` and `gzipExt` | ||
and `part`. Throws an error if has occurred and if the file already exists | ||
for exclusive mode. | ||
@@ -112,7 +108,8 @@ ### createReadStream | ||
- `ext` is a default extension added to file name for the object (optional, | ||
default: `this.ext`) | ||
- `ext` is a default extension added to the file name for the object | ||
(optional, default: `this.ext`) | ||
Creates a readable stream for an existing, gunzipped object in the storage. | ||
Throws an error if has occurred or the object doesn't exist or its size is zero. | ||
Throws an error if has occurred or if the object doesn't exist or its size is | ||
zero. | ||
@@ -127,10 +124,10 @@ ### commit | ||
- `ext` is a default extension added to file name for the object (optional, | ||
default: `this.ext`) | ||
- `part` is a extension added to file name which can be later commited | ||
- `ext` is a default extension added to the file name for the object | ||
(optional, default: `this.ext`) | ||
- `part` is a extension added to the file name which can be later committed | ||
(optional, default: `this.part`) | ||
Commits the object in the storage. It means that file name for the object is | ||
renamed and the additional extension for partial objects is removed. Throws an | ||
error if has occurred or the object doesn't exist. | ||
Commits the object in the storage. It means that the file name for the object | ||
is renamed and the additional extension for partial objects is removed. | ||
Throws an error if has occurred or the object doesn't exist. | ||
@@ -145,4 +142,4 @@ ### remove | ||
- `ext` is a default extension added to file name for the object (optional, | ||
default: `this.ext`) | ||
- `ext` is a default extension added to the file name for the object | ||
(optional, default: `this.ext`) | ||
@@ -154,4 +151,4 @@ Removes the object from the storage. Throws an error if has occurred or the | ||
Copyright (c) 2018-2020 Piotr Roszatycki <piotr.roszatycki@gmail.com> | ||
Copyright (c) 2018-2024 Piotr Roszatycki <piotr.roszatycki@gmail.com> | ||
[MIT](https://opensource.org/licenses/MIT) |
/// <reference types="node" /> | ||
import {Readable, Writable} from "stream" | ||
import zlib from "zlib" | ||
import {Readable, Writable} from "node:stream" | ||
import zlib from "node:zlib" | ||
@@ -6,0 +6,0 @@ import Pumpify from "pumpify" |
{ | ||
"extends": "@tsconfig/node16/tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"esModuleInterop": true, | ||
"importHelpers": true, | ||
"lib": ["es2018"], | ||
"module": "commonjs", | ||
"noImplicitAny": true, | ||
@@ -13,8 +11,8 @@ "noImplicitReturns": true, | ||
"outDir": "./lib", | ||
"sourceMap": true, | ||
"strict": true, | ||
"target": "es2018", | ||
"typeRoots": ["node_modules/@types"] | ||
}, | ||
"exclude": ["./examples/**/*", "./lib/**/*", "./test/**/*"] | ||
"exclude": ["./examples/**/*", "./lib/**/*", "./test/**/*"], | ||
"ts-node": { | ||
"transpileOnly": true | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
2
Yes
14939
33
7
159
147
+ Addedfs-blob-storage@4.1.0(transitive)
- Removedtslib@^2.0.2
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfs-blob-storage@3.1.0(transitive)
- Removedfs.mkdir-shim@2.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedmake-dir@1.3.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedpify@3.0.0(transitive)
- Removedtslib@2.8.1(transitive)
Updatedfs-blob-storage@^4.1.0