globSource missing! #585
Comments
|
@ekkis there's been a delay and the latest versions of js-ipfs-http-client and js-ipfs that these docs refer to haven't yet been published (although there is a prerelease of js-ipfs-http-client Until ipfs-http-client@42 and ipfs@0.41 are released, please checkout the docs at this revision: https://github.com/ipfs/interface-js-ipfs-core/tree/e51d27cb04faf87b15c03bf7a4055b216c45895f If you want to add a directory recursively with the current version, you can use |
|
thank you @alanshaw. on closer inspection I realised that the latest on NPM is missing the last line of what I find on github, namely: Object.assign(ipfsClient, { Buffer, CID, multiaddr, multibase, multicodec, multihash, globSource, urlSource })which contains what I need. I will pursue |
|
in trying your suggestion, I have: var args = process.argv.slice(2);
const IPFS = require('ipfs')
IPFS.create().then(async ipfs => {
for await (const f of ipfs.addFromFs(args[0], {recursive: false})) {
console.log(f);
}
})but I'm getting:
I've verified that |
|
if I look at function () {
var args = [].slice.call(arguments)
var ctx = this
if (args.length >= 1 &&
typeof args[args.length - 1] === 'function') {
// callback mode
var cb = args.pop()
fn.apply(this, args)
.then(function (val) { cb.call(ctx, null, val) },
function (err) { cb.call(ctx, err) })
return
}
// promise mode
return fn.apply(ctx, arguments)
}so it serves as a passthrough for some other function stored in |
|
when I look in |
|
ah... so the method is included in 'use strict'
const callbackify = require('callbackify')
const globSource = require('ipfs-utils/src/files/glob-source')
const all = require('async-iterator-all')
module.exports = self => {
return callbackify.variadic(async (...args) => { // eslint-disable-line require-await
const options = typeof args[args.length - 1] === 'string' ? {} : args.pop()
return all(self._addAsyncIterator(globSource(...args, options), options))
})
}and I gather |
|
oh my gosh. I'm such an idiot. I'm still attempting the loop as it was with the globSource. what I needed was simply: |
ekkis commentedJan 30, 2020
•
edited
in this README: https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md it is stated I can:
but when I do
globSourceis undefined. I initially installedipfsbut then installedipfs-http-client, neither of which this works for. can we fix the documentation, and what is the correct way to import the contents of a directory now?p.s. the above I'm attempting in NodeJs with v41.0.1 of ipfs-http-client and v0.40.0 of ipfs
p.p.s. the docs are also wrong in that they point the reader to do:
but, of course,
urlSourceis not defined (also not in IPFS). And the link offered in the document: "A great source of [examples] can be found in the tests for this API." https://github.com/ipfs/interface-ipfs-core/blob/master/src/files-regular generates a 404. grr...finally, when looking through the test suite I find https://github.com/ipfs/js-ipfs-http-client/blob/master/test/files-mfs.spec.js where the following code is displayed:
so that is of no help either. so frustrating. all I want to do is import a directory
The text was updated successfully, but these errors were encountered: