fs-blob-storage
Advanced tools
Comparing version
# Changelog | ||
## v0.4.1 2018-05-18 | ||
* Uses `stream.pipeline` shim instead `pump` in example scripts. | ||
## v0.4.0 2018-05-15 | ||
@@ -4,0 +8,0 @@ |
@@ -5,6 +5,8 @@ #!/usr/bin/env ts-node | ||
import pump from 'pump' | ||
import '@dex4er/stream.pipeline/auto' | ||
import stream from 'stream' | ||
import util from 'util' | ||
const pumpPromise: (...streams: pump.Stream[]) => Promise<void> = util.promisify(pump) | ||
const pipelinePromise = util.promisify(stream.pipeline) | ||
@@ -24,3 +26,3 @@ const SPOOLDIR = process.env.SPOOLDIR || '.' | ||
const stream = await storage.createReadStream(key) | ||
const readable = await storage.createReadStream(key) | ||
if (DEBUG) console.debug('createReadStream returned') | ||
@@ -31,3 +33,3 @@ | ||
if (DEBUG) { | ||
for (const s of [stream, process.stdout] as any[]) { | ||
for (const s of [readable, process.stdout] as any[]) { | ||
for (const event of ['close', 'data', 'drain', 'end', 'error', 'finish', 'pipe', 'readable', 'unpipe']) { | ||
@@ -43,3 +45,3 @@ if (s === process.stdout && ['data', 'readable'].includes(event)) continue | ||
await pumpPromise(stream, process.stdout) | ||
await pipelinePromise(readable, process.stdout) | ||
@@ -46,0 +48,0 @@ if (DEBUG) console.debug('stream ended') |
@@ -5,6 +5,8 @@ #!/usr/bin/env node | ||
const pump = require('pump') | ||
require('@dex4er/stream.pipeline/auto') | ||
const stream = require('stream') | ||
const util = require('util') | ||
const pumpPromise = util.promisify(pump) | ||
const pipelinePromise = util.promisify(stream.pipeline) | ||
@@ -24,3 +26,3 @@ const SPOOLDIR = process.env.SPOOLDIR || '.' | ||
const stream = await storage.createReadStream(key) | ||
const readable = await storage.createReadStream(key) | ||
if (DEBUG) console.debug('createReadStream returned') | ||
@@ -30,3 +32,3 @@ | ||
if (DEBUG) { | ||
for (const s of [stream, process.stdout]) { | ||
for (const s of [readable, process.stdout]) { | ||
for (const event of ['close', 'data', 'drain', 'end', 'error', 'finish', 'pipe', 'readable', 'unpipe']) { | ||
@@ -42,3 +44,3 @@ if (s === process.stdout && ['data', 'readable'].includes(event)) continue | ||
await pumpPromise(stream, process.stdout) | ||
await pipelinePromise(readable, process.stdout) | ||
@@ -45,0 +47,0 @@ if (DEBUG) console.debug('stream ended') |
@@ -5,6 +5,8 @@ #!/usr/bin/env ts-node | ||
import pump from 'pump' | ||
import '@dex4er/stream.pipeline/auto' | ||
import stream from 'stream' | ||
import util from 'util' | ||
const pumpPromise: (...streams: pump.Stream[]) => Promise<void> = util.promisify(pump) | ||
const pipelinePromise = util.promisify(stream.pipeline) | ||
@@ -24,3 +26,3 @@ const SPOOLDIR = process.env.SPOOLDIR || '.' | ||
const stream = await storage.createWriteStream(key) | ||
const writable = await storage.createWriteStream(key) | ||
if (DEBUG) console.debug('createWriteStream returned') | ||
@@ -31,3 +33,3 @@ | ||
if (DEBUG) { | ||
for (const s of [process.stdin, stream] as any[]) { | ||
for (const s of [process.stdin, writable] as any[]) { | ||
for (const event of ['close', 'data', 'drain', 'end', 'error', 'finish', 'pipe', 'readable', 'unpipe']) { | ||
@@ -42,3 +44,3 @@ const name = s === process.stdin ? 'stdin' : s.constructor.name | ||
await pumpPromise(process.stdin, stream) | ||
await pipelinePromise(process.stdin, writable) | ||
@@ -45,0 +47,0 @@ if (DEBUG) console.debug('stream finished') |
@@ -5,6 +5,8 @@ #!/usr/bin/env node | ||
const pump = require('pump') | ||
require('@dex4er/stream.pipeline/auto') | ||
const stream = require('stream') | ||
const util = require('util') | ||
const pumpPromise = util.promisify(pump) | ||
const pipelinePromise = util.promisify(stream.pipeline) | ||
@@ -24,3 +26,3 @@ const SPOOLDIR = process.env.SPOOLDIR || '.' | ||
const stream = await storage.createWriteStream(key) | ||
const writable = await storage.createWriteStream(key) | ||
if (DEBUG) console.debug('createWriteStream returned') | ||
@@ -30,3 +32,3 @@ | ||
if (DEBUG) { | ||
for (const s of [process.stdin, stream]) { | ||
for (const s of [process.stdin, writable]) { | ||
for (const event of ['close', 'data', 'drain', 'end', 'error', 'finish', 'pipe', 'readable', 'unpipe']) { | ||
@@ -41,3 +43,3 @@ const name = s === process.stdin ? 'stdin' : s.constructor.name | ||
await pumpPromise(process.stdin, stream) | ||
await pipelinePromise(process.stdin, writable) | ||
@@ -44,0 +46,0 @@ if (DEBUG) console.debug('stream finished') |
{ | ||
"name": "fs-blob-storage", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Blob storage on filesystem with promises API", | ||
@@ -31,5 +31,5 @@ "main": "lib/fs-blob-storage.js", | ||
"devDependencies": { | ||
"@dex4er/stream.pipeline": "^1.0.0", | ||
"@types/make-dir": "^1.0.3", | ||
"@types/node": "^10.0.10", | ||
"@types/pump": "^1.0.1", | ||
"@types/node": "^10.1.1", | ||
"chai": "^4.1.2", | ||
@@ -41,6 +41,5 @@ "chai-as-promised": "^7.1.1", | ||
"promise-writable": "^3.1.2", | ||
"pump": "^3.0.0", | ||
"snazzy": "^7.1.1", | ||
"standard": "^11.0.1", | ||
"tap": "^11.1.5", | ||
"tap": "^12.0.1", | ||
"tap-given": "^0.6.0", | ||
@@ -47,0 +46,0 @@ "tslint": "^5.10.0", |
38383
0.68%16
-5.88%1004
0.4%