# nft.storage

> A client library for the https://nft.storage/ service. It provides a convenient interface for working with the HTTP API from a web browser or Node.js

Latest version **7.2.0** (published 2024-07-01) · (Apache-2.0 OR MIT) license · 0 weekly downloads

## Install

```sh
npm install nft.storage
pnpm add nft.storage
yarn add nft.storage
bun add nft.storage
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 7.2.0 |
| Published | 2024-07-01 |
| First published | 2021-03-12 |
| Weekly downloads | 0 |
| License | (Apache-2.0 OR MIT) |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 13 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 604 |

## Links

- npm: https://www.npmjs.com/package/nft.storage
- Repository: https://github.com/nftstorage/nft.storage
- Homepage: https://github.com/nftstorage/nft.storage/tree/main/packages/client
- Issues: https://github.com/nftstorage/nft.storage/issues
- npm.io page: https://npm.io/package/nft.storage

## Dependencies (13)

- [it-pipe](https://npm.io/package/it-pipe.md) ^1.1.0
- [p-retry](https://npm.io/package/p-retry.md) ^4.6.1
- [carbites](https://npm.io/package/carbites.md) ^1.0.6
- [ipfs-car](https://npm.io/package/ipfs-car.md) ^0.6.2
- [@ipld/car](https://npm.io/package/@ipld/car.md) ^3.2.3
- [multiformats](https://npm.io/package/multiformats.md) ^9.6.4
- [@web-std/blob](https://npm.io/package/@web-std/blob.md) ^3.0.1
- [@web-std/file](https://npm.io/package/@web-std/file.md) ^3.0.0
- [@ipld/dag-cbor](https://npm.io/package/@ipld/dag-cbor.md) ^6.0.13
- [@web-std/fetch](https://npm.io/package/@web-std/fetch.md) ^4.1.2
- [throttled-queue](https://npm.io/package/throttled-queue.md) ^2.1.2
- [@web-std/form-data](https://npm.io/package/@web-std/form-data.md) ^3.0.0
- [streaming-iterables](https://npm.io/package/streaming-iterables.md) ^6.0.0

## Recent versions

- 7.2.0 (latest) — 2024-07-01
- 7.1.1 — 2023-07-20
- 7.1.0 — 2023-05-23
- 7.0.3 — 2023-02-28
- 7.0.0 — 2022-07-29
- 6.4.1 — 2022-07-18
- 6.4.0 — 2022-06-28
- 6.3.0 — 2022-05-20
- 6.2.0 — 2022-04-08
- 6.1.0 — 2022-03-24
- 6.0.2 — 2022-03-07
- 6.0.1 — 2022-03-01
- 6.0.0 — 2022-02-09
- 5.2.5 — 2022-02-09
- 5.2.4 — 2022-02-07
- … 50 more at https://npm.io/package/nft.storage/versions

## README

# nft.storage

### Notice: Uploads have been decommissioned, and upload functionality in this package no longer functions, even with a valid API key. Please visit <a href="https://nft.storage/nft-storage-classic">the product page</a> to learn more and find a new hot storage provider for uploading new assets.

![ci][ci.icon]
[![package][version.icon]][package.url]
[![styled with prettier][prettier.icon]][prettier.url]
[![size][size.icon]][size.url]
[![codecov][cov.icon]][cov.url]

A client library for the https://nft.storage/ service. It provides a convenient interface for working with the [Raw HTTP API][] from a web browser or [Node.js][] and comes bundled with TS for out-of-the box type inference and better IntelliSense.

## Install

Install the package using npm

```
npm install nft.storage
```

Or yarn

```
yarn add nft.storage
```

## Usage

First, obtain an API token from https://nft.storage and use it in place of `API_TOKEN` below:

```js
import { NFTStorage, File } from 'nft.storage'
const client = new NFTStorage({ token: 'API_TOKEN' })

async function main() {
  const metadata = await client.store({
    name: 'Pinpie',
    description: 'Pin is not delicious beef!',
    image: new File(
      [
        /* data */
      ],
      'pinpie.jpg',
      { type: 'image/jpg' }
    ),
  })
  console.log(metadata.url)
  // ipfs://bafyreib4pff766vhpbxbhjbqqnsh5emeznvujayjj4z2iu533cprgbz23m/metadata.json
}

main()
```

The client uses ESM modules. If running from Node.js, either name your script `index.mjs` or name it `index.js` _and_ use `npm init` to create a new `package.json` file in your project directory, adding `"type": "module",` to it.

Run the script:

```sh
node index.mjs # or index.js
```

For more examples please see the [API documentation](https://nftstorage.github.io/nft.storage/client/classes/lib.NFTStorage.html) or the [examples directory in the project repository][examples directory], which contains sample projects for both [browsers][examples.browser] and [Node.js][examples.node].

[raw http api]: https://nft.storage/api-docs/
[node.js]: https://nodejs.org/
[api documentation]: https://nftstorage.github.io/nft.storage/client/classes/lib.NFTStorage.html
[examples directory]: https://github.com/nftstorage/nft.storage/tree/main/examples/client
[examples.node]: https://github.com/nftstorage/nft.storage/tree/main/examples/client/node.js
[examples.browser]: https://github.com/nftstorage/nft.storage/tree/main/examples/client/browser
[ci.icon]: https://github.com/nftstorage/nft.storage/actions/workflows/client.yml/badge.svg
[version.icon]: https://img.shields.io/npm/v/nft.storage.svg
[package.url]: https://npmjs.org/package/nft.storage
[prettier.icon]: https://img.shields.io/badge/styled_with-prettier-ff69b4.svg
[prettier.url]: https://github.com/prettier/prettier
[size.icon]: https://badgen.net/bundlephobia/minzip/nft.storage
[size.url]: https://bundlephobia.com/result?p=nft.storage
[cov.icon]: https://codecov.io/gh/nftstorage/nft.storage/branch/main/graph/badge.svg?token=dU5oWrlqHF
[cov.url]: https://codecov.io/gh/nftstorage/nft.storage

---
_Source: https://npm.io/package/nft.storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
