mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
unlink directory when package is unpublished
This commit is contained in:
parent
78f856cf81
commit
fea98dfa59
2 changed files with 22 additions and 13 deletions
|
@ -208,39 +208,43 @@ Storage.prototype.path_to = function(file) {
|
|||
}
|
||||
|
||||
Storage.prototype.create = function(name, value, cb) {
|
||||
create(this.path + '/' + name, value, cb);
|
||||
create(this.path + '/' + name, value, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.create_json = function(name, value, cb) {
|
||||
create(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb);
|
||||
create(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb)
|
||||
}
|
||||
|
||||
Storage.prototype.update = function(name, value, cb) {
|
||||
update(this.path + '/' + name, value, cb);
|
||||
update(this.path + '/' + name, value, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.update_json = function(name, value, cb) {
|
||||
update(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb);
|
||||
update(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb)
|
||||
}
|
||||
|
||||
Storage.prototype.write = function(name, value, cb) {
|
||||
write(this.path + '/' + name, value, cb);
|
||||
write(this.path + '/' + name, value, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.write_json = function(name, value, cb) {
|
||||
write(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb);
|
||||
write(this.path + '/' + name, JSON.stringify(value, null, '\t'), cb)
|
||||
}
|
||||
|
||||
Storage.prototype.write_stream = function(name, value, cb) {
|
||||
return write_stream(this.path + '/' + name, value, cb);
|
||||
return write_stream(this.path + '/' + name, value, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.read_stream = function(name, cb) {
|
||||
return read_stream(this.path + '/' + name, cb);
|
||||
return read_stream(this.path + '/' + name, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.unlink = function(name, cb) {
|
||||
fs.unlink(this.path + '/' + name, cb);
|
||||
fs.unlink(this.path + '/' + name, cb)
|
||||
}
|
||||
|
||||
Storage.prototype.rmdir = function(name, cb) {
|
||||
fs.rmdir(this.path + '/' + name, cb)
|
||||
}
|
||||
|
||||
module.exports = Storage;
|
||||
|
|
|
@ -59,15 +59,20 @@ Storage.prototype.add_package = function(name, metadata, callback) {
|
|||
}
|
||||
|
||||
Storage.prototype.remove_package = function(name, callback) {
|
||||
this.storage.unlink(name + '/' + info_file, function(err) {
|
||||
var self = this
|
||||
self.storage.unlink(name + '/' + info_file, function(err) {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
return callback(new UError({
|
||||
status: 404,
|
||||
msg: 'no such package available',
|
||||
}));
|
||||
}))
|
||||
}
|
||||
callback();
|
||||
});
|
||||
|
||||
// try to unlink the directory, but ignore errors because it can fail
|
||||
self.storage.rmdir(name, function(err) {
|
||||
callback()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Storage.prototype._read_create_package = function(name, callback) {
|
||||
|
|
Loading…
Add table
Reference in a new issue