-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Read file error on Windows #1000
Comments
Hi @EasonWang01! I was unable to replicate the issue, could you try again? As for the question on the Readable Stream example, you just need to pass a Readable Stream to Let me know if that works :) |
Thanks for reply. const IPFS = require('ipfs')
const stream = require('stream');
const path = require('path');
const node = new IPFS()
node.on('ready', (cb) => {
node.files.add({
content: fs.createReadStream('sample.txt', { start: 90, end: 99 })
}, (err, result) => {
if (err) { return cb(err) }
console.log('\nAdded file:', result[0].path, result[0].hash)
// process.exit()
})
}) |
You need to add a
Also, it seems you forgot to require fs and ready doesn't provide any callback. A correct way of doing that should be like:
|
Thanks,but it still got this error
|
Ah! You are using Windows. We don't fully support Windows yet, see #861 for the full thread. Closing this one as a duplicate. Apologies for the hurdles, help us achieve Windows support! |
Thanks,will using OSX when come back home. |
Hi,it running without problem,but the link got no content.Thanks Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/ipfs/QmbPVEbSsLUhXRN9vJQh2a4PvMDMs
const IPFS = require('ipfs')
const fs = require('fs');
const node = new IPFS()
node.on('ready', () => {
node.files.add({
path: '',
content: fs.createReadStream('./sample.txt', { start: 90, end: 99 })
}, (err, result) => {
if (err) { throw err }
console.log('\nAdded file:', result[0].path, result[0].hash)
// process.exit()
})
})
https://gateway.ipfs.io/ipfs/QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP the file content is empty |
thanks! |
then https://gateway.ipfs.io/ipfs/....hash
the browser will keep loading and not showing the file.
2.Is there an example that using Readstream to add file to ipfs?
something like
Because in the test example https://github.com/ipfs/interface-ipfs-core/blob/master/src/files.js
but the loadFixture function still using
https://github.com/ipfs/aegir/blob/master/src/fixtures.js
The text was updated successfully, but these errors were encountered: