Skip to content

[BUG] Put failed due to TypeError: Data must be a string or a buffer #51

Open
@shentaoy

Description

@shentaoy

What / Why

Running example failed

fetch(
  'https://registry.npmjs.org/cacache/-/cacache-1.0.0.tgz'
).then(data => {
  return cacache.put(cachePath, 'registry.npmjs.org|[email protected]', data)
}).then(integrity => {
  console.log('integrity hash is', integrity)
})

(node:443) UnhandledPromiseRejectionWarning: TypeError: Data must be a string or a buffer
at Hash.update (crypto.js:99:16)
at algorithms.reduce (/repo/apps/allen/node-test/node_modules/ssri/index.js:322:44)
at Array.reduce ()
at Object.fromData (/repo/apps/allen/node-test/node_modules/ssri/index.js:317:21)
at write (/repo/apps/allen/node-test/node_modules/cacache/lib/content/write.js:31:20)
at Object.putData [as put] (/repo/apps/allen/node-test/node_modules/cacache/put.js:20:10)
at fetch.then.data (/repo/apps/allen/node-test/tests/cacache.js:39:20)
at
at process._tickCallback (internal/process/next_tick.js:189:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions