Constructor
new IpfsXml(file, options)
Create a new XML HTTP Request IPFS Uploader
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file |
File | Blob | ||||||||||||||||
options |
Object |
The Options for this Upload Properties
|
- Source:
Methods
onProgress(progressFunction)
Subscribe to upload Progress events
Parameters:
Name | Type | Description |
---|---|---|
progressFunction |
function |
The function you want called when there is a progress update available |
- Source:
Example
let uploader = new XMLRequestIPFSAdd(input.files[0], {
"host": "ipfs-dev.alexandria.io",
"protocol": "https",
"port": 443,
"oip_auth": {
address:"oNRs1nuR1vUAjWJwhMtxJPQoTFAm9MWz1G",
message:'1534278675842{"oip042":{}}',
signature:"Hw2iuomv/fhYYoKX8bNroVXmOvbh/e9gqZjP+I9kZymHD72mqtDw1qjN6/Qh4nhTDOHI8mkxbWtsaLSTuCkSihU="
}
})
uploader.onProgress((progress_message) => {
console.log("Progress! " + JSON.stringify(progress_message))
})
start() → {Promise.<Object>}
Start the File Upload to the server
- Source:
Example
let uploader = new XMLRequestIPFSAdd(input.files[0], {
"host": "ipfs-dev.alexandria.io",
"protocol": "https",
"port": 443,
"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>