File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed
Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change 11import { create } from 'kubo-rpc-client' ;
2- import { IPFS_UPLOAD_URL , DEFAULT_IPFS_GATEWAY } from '../config/config.js' ;
32
43interface GetOptions {
54 ipfsGateway ?: string ;
@@ -8,10 +7,7 @@ interface AddOptions extends GetOptions {
87 ipfsNode ?: string ;
98}
109
11- const get = async (
12- cid ,
13- { ipfsGateway = DEFAULT_IPFS_GATEWAY } : GetOptions = { }
14- ) => {
10+ const get = async ( cid , { ipfsGateway } : GetOptions = { } ) => {
1511 const multiaddr = `/ipfs/${ cid . toString ( ) } ` ;
1612 const publicUrl = `${ ipfsGateway } ${ multiaddr } ` ;
1713 const res = await fetch ( publicUrl ) ;
@@ -22,13 +18,7 @@ const get = async (
2218 return new Uint8Array ( arrayBuffer ) ;
2319} ;
2420
25- const add = async (
26- content ,
27- {
28- ipfsNode = IPFS_UPLOAD_URL ,
29- ipfsGateway = DEFAULT_IPFS_GATEWAY ,
30- } : AddOptions = { }
31- ) => {
21+ const add = async ( content , { ipfsNode, ipfsGateway } : AddOptions = { } ) => {
3222 const ipfsClient = create ( ipfsNode ) ;
3323 const { cid } = await ipfsClient . add ( content ) ;
3424 await get ( cid . toString ( ) , { ipfsGateway } ) ;
You can’t perform that action at this time.
0 commit comments