forked from ipfs/js-ipfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: port examples to new api (ipfs#1222)
* fix: change name-api examples to new api * fix: change files-api example to new api * fix: change upload example to new api * fix: change bundle-webpack to support new api * fix: remove browserify example doesnt support imports * fix: change pubsub example to the new api * Update examples/bundle-webpack/src/App.js Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai> * Update examples/bundle-webpack/src/App.js Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai> * Update examples/files-api/files-api.js Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai> * Update examples/upload-file-via-browser/src/App.js Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai> * Update examples/upload-file-via-browser/src/App.js Co-Authored-By: Alan Shaw <alan.shaw@protocol.ai> Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
- Loading branch information
1 parent
d3eee0d
commit 74a9147
Showing
22 changed files
with
24,529 additions
and
1,200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
/* eslint-disable no-console */ | ||
'use strict' | ||
|
||
const ipfs = require('../../src')('localhost', 5001) | ||
// Run `ipfs daemon` in your terminal to start the IPFS daemon | ||
// Look for `API server listening on /ip4/127.0.0.1/tcp/5001` | ||
const ipfs = require('../../src')('/ip4/127.0.0.1/tcp/5001') | ||
|
||
ipfs.files.ls('/folder1', function (err, res) { | ||
if (err) { | ||
return console.log('got an error', err) | ||
} | ||
if (res.readable) { | ||
res.pipe(process.stdout) | ||
} else { | ||
console.log(res) | ||
const run = async () => { | ||
await ipfs.files.write( | ||
'/temp/hello-world', | ||
Buffer.from('Hello, world!'), | ||
{ create: true, parents: true } | ||
) | ||
const source = ipfs.files.ls('/temp') | ||
|
||
for await (const file of source) { | ||
console.log(file) | ||
} | ||
}) | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.