This repository was archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
files.cat stream doesn't auto resume .on('data') #939
Copy link
Copy link
Closed
Labels
P3Low: Not priority right nowLow: Not priority right nowexp/expertHaving worked on the specific codebase is importantHaving worked on the specific codebase is importanthelp wantedSeeking public contribution on this issueSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)
Description
I wrote this simple demo on jsbin, but somehow the content stream does not emit any data?
I would love to see such a simple demo here in the repo and I will submit a pull request if wanted to this repo
https://jsbin.com/covirovuxe/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/ipfs/dist/index.min.js"></script>
<script>
const node = new Ipfs()
node.on('ready', () => {
// Your node is now ready to use \o/
console.log('ready')
node.files.get('QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', (err, data) => {
console.log(err, data)
data.on('data', (file) => {
console.log(file)
if(!file.content) return
// write the file's path and contents to standard out
file.content.on('data', function (chunk) {
console.log(chunk)
})
file.content.on('error', function (error) {
console.log(error)
})
file.content.on('end', function () {
console.log('no more data')
})
})
})
})
</script>
</body>
</html>
Metadata
Metadata
Assignees
Labels
P3Low: Not priority right nowLow: Not priority right nowexp/expertHaving worked on the specific codebase is importantHaving worked on the specific codebase is importanthelp wantedSeeking public contribution on this issueSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)