Skip to content

Commit

Permalink
chore: set up npm workspace
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Oli Evans <[email protected]>
  • Loading branch information
olizilla committed Jun 21, 2021
0 parents commit 0228a79
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# filecoin.storage

The simple file storage service for IPFS & Filecoin

## Getting started

This project uses node v16 and npm v7. It's a monorepo that use [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) to handle resolving dependencies between the local packages/* folders.

```console
npm install
```

To add a new workspace to the repo:

```console
npm init -w ./packages/website
```

To run an npm script in one or more workspaces

```console
npm run test --workspace=a --workspace=b
```

13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "filecoin.storage",
"version": "1.0.0",
"private": true,
"scripts": {
"test": "say sorry"
},
"license": "(Apache-2.0 AND MIT)",
"workspaces": [
"packages/api",
"packages/client"
]
}
19 changes: 19 additions & 0 deletions packages/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# filecoin.storage API

## API

### 🔐 `PUT /car/:cid`

Upload a CAR for a root CID. _Authenticated_

### `GET /car/:cid`

Fetch a CAR by CID.

### `HEAD /car/:cid`

Fetch headers like content-length for a given CAR.

### `GET /root/:cid/deals`

Get filecoin deals info. (*TBD*) We need to define what info we want here to find the right status.
11 changes: 11 additions & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "filecoin.storage-api",
"private": true,
"version": "0.0.0",
"main": "index.js",
"scripts": {
"test": "say sorry"
},
"author": "",
"license": "(Apache-2.0 AND MIT)"
}
33 changes: 33 additions & 0 deletions packages/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# filecoin.storage client

API client for filecoin.storage

## Usage

```js
import FilecoinStorage from 'filecoin.storage'

// Construct with token and endpoint
const client = new FilecoinStorage({ token: apiKey })

// Pack files into a CAR
client.pack(files: Iterable<File>): Promise<{car: Blob, root: CIDString}>

// Store a CAR
client.store(car: Blob): Promise<CIDString>

// Send the files, packing them into a CAR under the hood
client.packAndStore(files: Iterable<File>): Promise<CIDString>

// Get info on the Filecoin deals that the CID is stored in
client.status(cid: string): Promise<Metadata>

// Fetch a CAR over http
client.get(cid: string): Promise<Blob>

// Unpack and verify a CAR
client.unpack(car: Blob): AsyncIterable<?>

// Fetch, verify and unpack the CID to files
client.getAndUnpack(cid: string): AsyncIterable<?>
```
19 changes: 19 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "filecoin.storage",
"version": "0.0.0",
"description": "API client for filecoin.storage",
"main": "index.js",
"scripts": {
"test": "say sorry"
},
"license": "(Apache-2.0 AND MIT)",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/filecoin-storage/filecoin.storage.git"
},
"author": "",
"bugs": {
"url": "https://github.com/filecoin-storage/filecoin.storage/issues"
},
"homepage": "https://github.com/filecoin-storage/filecoin.storage#readme"
}

0 comments on commit 0228a79

Please sign in to comment.