diff options
author | Rebecca Turner <me@re-becca.org> | 2018-04-20 18:26:37 -0700 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-05-24 23:24:45 -0700 |
commit | 468ab4519e1b92473acefb22801497a1af6aebae (patch) | |
tree | bdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/cacache/put.js | |
parent | ac8226115e2192a7a46ba07789fa5136f74223e1 (diff) | |
download | android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2 android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip |
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/cacache/put.js')
-rw-r--r-- | deps/npm/node_modules/cacache/put.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/deps/npm/node_modules/cacache/put.js b/deps/npm/node_modules/cacache/put.js index fe1293e5e7..0b0ee14978 100644 --- a/deps/npm/node_modules/cacache/put.js +++ b/deps/npm/node_modules/cacache/put.js @@ -1,17 +1,31 @@ 'use strict' +const figgyPudding = require('figgy-pudding') const index = require('./lib/entry-index') const memo = require('./lib/memoization') const write = require('./lib/content/write') const to = require('mississippi').to +const PutOpts = figgyPudding({ + algorithms: { + default: ['sha512'] + }, + integrity: {}, + memoize: {}, + metadata: {}, + size: {}, + tmpPrefix: {}, + uid: {}, + gid: {} +}) + module.exports = putData function putData (cache, key, data, opts) { - opts = opts || {} + opts = PutOpts(opts) return write(cache, data, opts).then(res => { - // TODO - stop modifying opts - opts.size = res.size - return index.insert(cache, key, res.integrity, opts).then(entry => { + return index.insert( + cache, key, res.integrity, opts.concat({size: res.size}) + ).then(entry => { if (opts.memoize) { memo.put(cache, entry, data, opts) } @@ -22,7 +36,7 @@ function putData (cache, key, data, opts) { module.exports.stream = putStream function putStream (cache, key, opts) { - opts = opts || {} + opts = PutOpts(opts) let integrity let size const contentStream = write.stream( @@ -45,9 +59,7 @@ function putStream (cache, key, opts) { }) }, cb => { contentStream.end(() => { - // TODO - stop modifying `opts` - opts.size = size - index.insert(cache, key, integrity, opts).then(entry => { + index.insert(cache, key, integrity, opts.concat({size})).then(entry => { if (opts.memoize) { memo.put(cache, entry, Buffer.concat(memoData, memoTotal), opts) } |