Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@verdaccio/local-storage

Package Overview
Dependencies
Maintainers
5
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@verdaccio/local-storage - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

10

CHANGELOG.md

@@ -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)

86

lib/local-fs.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc