Get started with ipfs CDN
MIT licensed
IPFS library: create, retrieve, verify content-addressed objects in InterPlanetary File System.
Tags:- filesystem
- IPFS
Stable version
Copied!
How to start using ipfs CDN
// Import IPFS library from CDN
const IPFS = await fetch('https://cdn.cdnhub.io/ipfs/0.66.1/index.min.js').then(res => res.text());
(window.IPFS = window.IPFS || {}).Daemon = IPFS;
// Initialize IPFS node
const ipfs = new IPFS({
config: {
Addresses: {
Swarm: ['/ipfs/127.0.0.1:5001', '/ipfs/127.0.0.1:5002'] // Replace with your IPFS node addresses
}
}
});
// Add a file to IPFS
const file = new File(['Hello, IPFS!'], 'hello.txt', { type: 'text/plain' });
const added = await ipfs.add(file);
// Print IPFS hash of the added file
console.log('Added file:', added.path);
// Retrieve a file from IPFS
const getFile = async (hash) => {
const file = await ipfs.get(hash);
return file.content;
};
// Get a file from IPFS and print its content
const content = await getFile(added.path);
console.log('File content:', content.toString());
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
0.0.1-2a6fede5.0
0.0.1-563806f1.0
0.0.1-e85e5b6e.0
0.10.0
0.10.1
0.10.2
0.10.3
0.11.0
0.11.1
0.12.0
0.13.0
0.14.0
0.14.1
0.14.2
0.14.3
0.15.0
0.16.0
0.17.0
0.18.0
0.19.0
0.20.1
0.20.2
0.20.3
0.20.4
0.21.0
0.21.1
0.21.2
0.21.3
0.21.4
0.21.5
0.21.6
0.21.7
0.21.8
0.22.0
0.22.1
0.23.0
0.23.1
0.24.0
0.24.1
0.25.0
0.25.1
0.25.2
0.25.3
0.25.4
0.26.0
0.27.0
0.27.1
0.27.2
0.27.3
0.27.4
0.27.5
0.27.6
0.27.7
0.28.0
0.28.1
0.28.2
0.29.0
0.29.1
0.29.2
0.29.3
0.30.0
0.30.1
0.31.0
0.31.1
0.31.2
0.31.3
0.31.4
0.31.5
0.31.7
0.32.0
0.32.0-rc.1
0.32.0-rc.2
0.32.2
0.32.3
0.33.0
0.33.0-rc.1
0.33.0-rc.2
0.33.0-rc.3
0.33.0-rc.4
0.33.1
0.34.0
0.34.0-pre.0
0.34.0-rc.0
0.34.0-rc.1
0.34.1
0.34.2
0.34.3
0.34.4
0.35.0
0.35.0-pre.0
0.35.0-rc.0
0.35.0-rc.1
0.35.0-rc.2
0.35.0-rc.3
0.35.0-rc.4
0.35.0-rc.5
0.35.0-rc.6
0.35.0-rc.7
0.36.0
0.36.0-pre.0
0.36.0-rc.0
0.36.1
0.36.2
0.36.3
0.36.4
0.37.0
0.37.0-rc.0
0.37.0-rc.1
0.37.1
0.38.0
0.38.0-pre.0
0.38.0-pre.1
0.38.0-rc.1
0.38.0-rc.2
0.38.0-rc.3
0.38.0-rc.4
0.38.0-rc.5
0.38.0-rc.6
0.38.1
0.39.0
0.39.0-rc.0
0.39.0-rc.1
0.39.0-rc.2
0.39.1
0.4.10
0.4.6
0.4.7
0.4.8
0.4.9
0.40.0
0.40.0-rc.0
0.40.0-rc.1
0.41.0
0.41.0-rc.0
0.41.0-rc.1
0.41.0-rc.2
0.41.1
0.41.2
0.41.3-rc.5605
0.41.3-rc.5606
0.41.3-rc.5614
0.41.3-rc.5616
0.41.3-rc.5619
0.41.3-rc.5621
0.42.0
0.42.1
0.42.2-rc.4
0.42.2-rc.5
0.43.0
0.43.1
0.43.1-rc.13
0.43.2
0.43.2-rc.1
0.43.3
0.43.4-rc.3
0.44.0
0.44.1-rc.7
0.44.1-rc.8
0.45.0
0.45.1-rc.2
0.45.1-rc.3
0.46.0
0.46.1
0.46.1-rc.11
0.46.1-rc.2
0.46.1-rc.24
0.46.1-rc.3
0.46.1-rc.32
0.47.0
0.47.1-rc.12
0.47.1-rc.14
0.47.1-rc.19
0.47.1-rc.2
0.47.1-rc.21
0.47.1-rc.26
0.47.1-rc.3
0.47.1-rc.5
0.47.1-rc.6
0.47.1-rc.7
0.48.0
0.48.1
0.48.1-rc.2
0.48.1-rc.5
0.48.2
0.48.2-rc.0
0.48.2-rc.1
0.48.2-rc.2
0.48.2-rc.3
0.49.0
0.49.1
0.49.1-rc.2
0.49.2-rc.0
0.49.2-rc.12
0.49.2-rc.3
0.49.2-rc.4
0.49.2-rc.5
0.5.0
0.50.0
0.50.1
0.50.1-rc.25
0.50.2
0.50.2-rc.2
0.50.3-rc.1
0.50.3-rc.11
0.50.3-rc.12
0.50.3-rc.14
0.50.3-rc.15
0.50.3-rc.16
0.50.3-rc.2
0.50.3-rc.22
0.50.3-rc.24
0.50.3-rc.25
0.50.3-rc.26
0.50.3-rc.28
0.50.3-rc.29
0.50.3-rc.3
0.50.3-rc.31
0.50.3-rc.4
0.51.0
0.51.1-rc.10
0.51.1-rc.12
0.51.1-rc.13
0.51.1-rc.2
0.51.1-rc.4
0.51.1-rc.5
0.51.1-rc.6
0.51.1-rc.8
0.52.0
0.52.1
0.52.1-rc.1
0.52.1-rc.3
0.52.1-rc.5
0.52.1-rc.7
0.52.1-rc.8
0.52.2
0.52.2-rc.2
0.52.2-rc.3
0.52.2-rc.6
0.52.2-rc.8
0.52.3
0.52.3-rc.1
0.52.3-rc.13
0.52.3-rc.2
0.52.4-rc.1
0.52.4-rc.4
0.52.4-rc.5
0.52.4-rc.6
0.53.0
0.53.1
0.53.2
0.53.3-rc.3
0.54.0
0.54.1
0.54.2
0.54.3
0.54.3-rc.4
0.54.3-rc.5
0.54.4
0.54.5
0.54.5-rc.11
0.54.5-rc.14
0.54.5-rc.17
0.54.5-rc.18
0.54.5-rc.19
0.54.5-rc.20
0.54.5-rc.21
0.54.5-rc.22
0.54.5-rc.24
0.54.5-rc.25
0.54.5-rc.26
0.54.5-rc.27
0.54.5-rc.28
0.54.5-rc.29
0.54.5-rc.3
0.54.5-rc.30
0.54.5-rc.31
0.54.5-rc.32
0.55.0
0.55.1
0.55.1-rc.1
0.55.2
0.55.2-rc.1
0.55.2-rc.2
0.55.2-rc.3
0.55.2-rc.7
0.55.3
0.55.3-rc.1
0.55.3-rc.3
0.55.3-rc.4
0.55.4
0.55.4-rc.1
0.55.4-rc.2
0.55.4-rc.3
0.55.4-rc.4
0.55.5-rc.1
0.55.5-rc.11
0.55.5-rc.14
0.55.5-rc.17
0.55.5-rc.2
0.55.5-rc.3
0.55.5-rc.6
0.55.5-rc.8
0.55.5-rc.9
0.56.0
0.56.1
0.56.1-rc.1
0.56.1-rc.2
0.56.1-rc.5
0.56.1-rc.7
0.56.2
0.56.2-rc.1
0.56.2-rc.10
0.56.2-rc.11
0.56.2-rc.2
0.56.2-rc.3
0.56.2-rc.6
0.56.2-rc.8
0.57.0
0.57.1
0.57.1-rc.10
0.57.1-rc.4
0.57.1-rc.5
0.57.1-rc.6
0.57.1-rc.7
0.57.1-rc.9
0.58.0
0.58.1
0.58.1-rc.1
0.58.2
0.58.2-rc.1
0.58.2-rc.3
0.58.2-rc.4
0.58.3
0.58.3-rc.2
0.58.3-rc.3
0.58.3-rc.4
0.58.3-rc.5
0.58.3-rc.6
0.58.3-rc.7
0.58.3-rc.8
0.58.4
0.58.4-rc.1
0.58.4-rc.2
0.58.4-rc.4
0.58.4-rc.5
0.58.5
0.58.5-rc.1
0.58.5-rc.4
0.58.6
0.58.6-rc.0
0.58.7-rc.0
0.58.7-rc.1
0.58.7-rc.12
0.58.7-rc.14
0.58.7-rc.15
0.58.7-rc.16
0.58.7-rc.17
0.58.7-rc.18
0.59.0
0.59.1
0.59.1-rc.0
0.59.1-rc.1
0.59.1-rc.2
0.59.1-rc.3
0.59.1-rc.5
0.59.2-rc.0
0.59.2-rc.1
0.59.2-rc.2
0.59.2-rc.3
0.59.2-rc.4
0.59.2-rc.5
0.59.2-rc.6
0.6.0
0.6.1
0.60.0
0.60.1-rc.0
0.60.1-rc.1
0.60.2
0.60.2-rc.0
0.60.2-rc.1
0.60.2-rc.2
0.60.2-rc.3
0.60.3-rc.0
0.60.3-rc.1
0.60.3-rc.10
0.60.3-rc.11
0.60.3-rc.12
0.60.3-rc.13
0.60.3-rc.2
0.60.3-rc.3
0.60.3-rc.4
0.60.3-rc.5
0.60.3-rc.6
0.60.3-rc.7
0.60.3-rc.8
0.60.3-rc.9
0.61.0
0.61.1-5439a0e.0
0.61.1-6cb3a87e.0
0.61.1-7fe0da57f.0
0.61.1-a6b201af.0
0.61.1-cca6e321.0
0.61.1-fbe14923.0
0.61.1-rc.0
0.61.1-rc.1
0.61.1-rc.2
0.61.1-rc.3
0.61.1-rc.4
0.61.1-rc.5
0.62.0
0.62.1
0.62.1-2afef2eb.0
0.62.1-2c8ec080.0
0.62.1-383dc07d.0
0.62.1-3a5d61d4.0
0.62.1-3a74c110.0
0.62.1-709831f6.0
0.62.1-8d260215.0
0.62.2
0.62.2-1082fce9.0
0.62.2-125d42ba.0
0.62.2-df1bd1bb.0
0.62.3
0.62.3-8f7ce23c.0
0.62.3-e90b8f13.0
0.62.4-4e93dd5d.0
0.62.4-7165bf71.0
0.62.4-919b27a8.0
0.63.0
0.63.1
0.63.1-ddfb899f.0
0.63.2
0.63.2-764b4adc.0
0.63.2-87e00a69.0
0.63.2-be025c89.0
0.63.3
0.63.3-70e142ac.0
0.63.4
0.63.4-7be50bd1.0
0.63.5
0.63.5-00bd3dd0.0
0.63.6-051da161.0
0.63.6-39dbf708.0
0.63.6-83f9882e.0
0.63.6-8f351a89.0
0.63.6-a05695fc.0
0.64.0
0.64.1
0.64.1-7c676f63.0
0.64.1-b5456882.0
0.64.2
0.64.2-2a830bf5.0
0.64.2-7304a0f4.0
0.64.3-0cee4a4c.0
0.64.3-acbc1c62.0
0.64.3-d1b0a8a7.0
0.64.3-d75e0a39.0
0.64.3-dfc43d4e.0
0.65.0
0.65.0-4b4c124c
0.65.0-5f73ecad
0.65.0-789ee585
0.65.0-d1c3abb3
0.65.0-fa578bac
0.65.1-58e6f468.0
0.65.1-6ae5eb7d.0
0.65.1-6be59068.0
0.65.1-a77e40cc.0
0.66.0
0.66.0-3bcabe38
0.66.0-4694e806
0.66.0-6d95ce08
0.66.0-6eeb1be5
0.66.0-7b79c1b8
0.66.0-ab02e8f8
0.66.0-b64d4af0
0.66.0-e64813f6
*** 0.66.1
0.7.0
0.8.0