Constructor
new IpfsHttpApi(file, options)
Create a new IPFS Node.js Add
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file |
Buffer | ReadableStream | PullStream | |||||||||||||||||||||||||||||
options |
Object |
The Options for this Upload Properties
|
- Source:
Methods
onProgress(progress_function)
Subscribe to upload Progress events
Parameters:
Name | Type | Description |
---|---|---|
progress_function |
function |
The function you want called when there is a progress update available |
- Source:
Example
let uploader = new IPFSBrowserAdd(input.files[0], {
"api_url": "https://ipfs-dev.alexandria.io",
"oip_auth": {
address:"oNRs1nuR1vUAjWJwhMtxJPQoTFAm9MWz1G",
message:'1534278675842{"oip042":{}}',
signature:"Hw2iuomv/fhYYoKX8bNroVXmOvbh/e9gqZjP+I9kZymHD72mqtDw1qjN6/Qh4nhTDOHI8mkxbWtsaLSTuCkSihU="
}
})
uploader.onProgress((progress_message) => {
console.log("Progress! " + JSON.stringify(progress_message))
})
(async) start() → {Promise.<Object>}
Start the File Upload to the server
- Source:
Example
let uploader = new IPFSBrowserAdd(input.files[0], {
"api_url": "https://ipfs-dev.alexandria.io",
"oip_auth": {
address:"oNRs1nuR1vUAjWJwhMtxJPQoTFAm9MWz1G",
message:'1534278675842{"oip042":{}}',
signature:"Hw2iuomv/fhYYoKX8bNroVXmOvbh/e9gqZjP+I9kZymHD72mqtDw1qjN6/Qh4nhTDOHI8mkxbWtsaLSTuCkSihU="
}
})
uploader.onProgress((progress_message) => {
console.log("Progress! " + JSON.stringify(progress_message))
})
uploader.start().then((success_response) => {
console.log("Upload Complete! " + JSON.stringify(success_response))
})
Returns:
Returns a Promise that will resolve to the IPFS Added object JSON
- Type:
- Promise.<Object>