@verdaccio/local-storage
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.7"></a> | ||
## [1.1.7](https://github.com/verdaccio/local-storage/compare/v1.1.6...v1.1.7) (2019-02-24) | ||
### Bug Fixes | ||
* avoid open write stream if resource exist [#1191](https://github.com/verdaccio/local-storage/issues/1191) ([2c474b2](https://github.com/verdaccio/local-storage/commit/2c474b2)) | ||
<a name="1.1.6"></a> | ||
@@ -7,0 +17,0 @@ ## [1.1.6](https://github.com/verdaccio/local-storage/compare/v1.1.5...v1.1.6) (2019-02-11) |
@@ -189,52 +189,52 @@ 'use strict'; | ||
uploadStream.emit('error', fSError(fileExist)); | ||
} | ||
} else { | ||
const temporalName = _path2.default.join(this.path, `${name}.tmp-${String(Math.random()).replace(/^0\./, '')}`); | ||
const file = _fs2.default.createWriteStream(temporalName); | ||
const removeTempFile = () => _fs2.default.unlink(temporalName, function () {}); | ||
let opened = false; | ||
uploadStream.pipe(file); | ||
const temporalName = _path2.default.join(this.path, `${name}.tmp-${String(Math.random()).replace(/^0\./, '')}`); | ||
const file = _fs2.default.createWriteStream(temporalName); | ||
const removeTempFile = () => _fs2.default.unlink(temporalName, function () {}); | ||
let opened = false; | ||
uploadStream.pipe(file); | ||
uploadStream.done = function () { | ||
const onend = function onend() { | ||
file.on('close', function () { | ||
renameTmp(temporalName, pathName, function (err) { | ||
if (err) { | ||
uploadStream.emit('error', err); | ||
} else { | ||
uploadStream.emit('success'); | ||
} | ||
}); | ||
}); | ||
file.end(); | ||
}; | ||
if (_ended) { | ||
onend(); | ||
} else { | ||
uploadStream.on('end', onend); | ||
} | ||
}; | ||
uploadStream.done = function () { | ||
const onend = function onend() { | ||
file.on('close', function () { | ||
renameTmp(temporalName, pathName, function (err) { | ||
if (err) { | ||
uploadStream.emit('error', err); | ||
} else { | ||
uploadStream.emit('success'); | ||
} | ||
uploadStream.abort = function () { | ||
if (opened) { | ||
opened = false; | ||
file.on('close', function () { | ||
removeTempFile(); | ||
}); | ||
}); | ||
} else { | ||
// if the file does not recieve any byte never is opened and has to be removed anyway. | ||
removeTempFile(); | ||
} | ||
file.end(); | ||
}; | ||
if (_ended) { | ||
onend(); | ||
} else { | ||
uploadStream.on('end', onend); | ||
} | ||
}; | ||
uploadStream.abort = function () { | ||
if (opened) { | ||
opened = false; | ||
file.on('close', function () { | ||
removeTempFile(); | ||
}); | ||
} else { | ||
// if the file does not recieve any byte never is opened and has to be removed anyway. | ||
removeTempFile(); | ||
} | ||
file.end(); | ||
}; | ||
file.on('open', function () { | ||
opened = true; | ||
// re-emitting open because it's handled in storage.js | ||
uploadStream.emit('open'); | ||
}); | ||
file.on('open', function () { | ||
opened = true; | ||
// re-emitting open because it's handled in storage.js | ||
uploadStream.emit('open'); | ||
}); | ||
file.on('error', function (err) { | ||
uploadStream.emit('error', err); | ||
}); | ||
file.on('error', function (err) { | ||
uploadStream.emit('error', err); | ||
}); | ||
} | ||
}); | ||
@@ -241,0 +241,0 @@ |
{ | ||
"name": "@verdaccio/local-storage", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "local storage implementation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63077
1459