upload_file_to_liquidstorage
Upload file to IPFS and have it pinned
1
import { getClient } from "./client";
2
​
3
(async () => {
4
const service = await (await getClient()).service('storage', "5jqee4kl1ns1");
5
const data = Buffer.from("a great success", "utf8");
6
const key = "5J5hLqZrc3DvURBtwapKjpYH676QMmoZvFUy2NGkyeYv4ZuxxhK";
7
const permission = "active";
8
const options = {
9
// if true, DAG leaves will contain raw file data and not be wrapped in a protobuf
10
rawLeaves: true
11
};
12
const response = await service.upload_public_file(
13
data,
14
key,
15
permission,
16
null,
17
options
18
);
19
console.log(`uri: ${response.uri}`);
20
})().catch((e) => { console.log(e); });
Copied!
Last modified 9mo ago
Copy link