asset-pipe-sink-fs
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -11,5 +11,4 @@ const JSONStream = require('JSONStream'); | ||
const SinkFs = module.exports = function (fileDir) { | ||
if (!(this instanceof SinkFs)) return new SinkFs(fileDir); | ||
if (!(this instanceof SinkFs)) { return new SinkFs(fileDir); } | ||
assert(fileDir, '"fileDir" must be provided'); | ||
@@ -21,3 +20,2 @@ | ||
SinkFs.prototype.writer = function (fileType, callback) { | ||
@@ -28,8 +26,8 @@ const temp = path.join(this.fileDir, common.createTemporaryFilename(fileType)); | ||
const proxy = new stream.PassThrough(); | ||
const file = fs.createWriteStream(temp); | ||
file.on('finish', () => { | ||
const id = hasher.hash; | ||
const fileName = id + '.' + fileType; | ||
const fileName = `${id}.${fileType}`; | ||
fs.rename(temp, path.join(this.fileDir, fileName), () => { | ||
@@ -53,7 +51,6 @@ if (callback) { | ||
SinkFs.prototype.reader = function (fileName, callback) { | ||
const from = this.fileDir + fileName; | ||
const file = fs.createReadStream(from); | ||
SinkFs.prototype.reader = function (fileName, callback) { | ||
let from = this.fileDir + fileName; | ||
let file = fs.createReadStream(from); | ||
file.on('finish', () => { | ||
@@ -60,0 +57,0 @@ if (callback) { |
{ | ||
"name": "asset-pipe-sink-fs", | ||
"version": "1.0.0-alpha.3", | ||
"version": "1.0.0-alpha.4", | ||
"author": { | ||
@@ -23,5 +23,2 @@ "name": "Trygve Lie", | ||
], | ||
"engines": { | ||
"node" : "6.x" | ||
}, | ||
"bugs": { | ||
@@ -32,12 +29,18 @@ "url": "https://github.com/asset-pipe/asset-pipe-sink-fs/issues" | ||
"dependencies": { | ||
"JSONStream": "1.2.1", | ||
"asset-pipe-common": "1.0.0-alpha.2", | ||
"readable-stream": "2.2.2", | ||
"JSONStream": "1.2.1" | ||
"readable-stream": "2.2.2" | ||
}, | ||
"devDependencies": { | ||
"tap": "8.0.1" | ||
"eslint": "^3.15.0", | ||
"eslint-config-finn": "^1.0.1", | ||
"tap": "10.0.2" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "tap test/*.js" | ||
} | ||
}, | ||
"files": [ | ||
"lib" | ||
] | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
-50%2511
-99.62%3
200%3
-62.5%44
-97.89%2
Infinity%