Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
trubavuong committed May 22, 2021
1 parent f30a057 commit ac70ff9
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,65 @@

NodeJS client for [SeaweedFS](https://github.com/chrislusf/seaweedfs)

# Quick start
## Install

```
$ npm install @trubavuong/seaweedfs
```

## APIs

### BlockStorage

```
const { BlockStorage } = require('@trubavuong/seaweedfs');
```

#### Constructor

```
const blockStorage = new BlockStorage({
endpoint: 'http://localhost:9333',
});
```

#### blockStorage.reserve({ count })

```
const { name } = blockStorage.reserve({
count: 10,
});
```

#### blockStorage.add({ data })

```
const { name, size } = blockStorage.add({
data: fileData,
});
```

#### blockStorage.replace({ data, name })

```
const { name, size } = blockStorage.replace({
name: fid,
data: fileData,
});
```

#### blockStorage.get({ name })

```
const fileStream = blockStorage.get({
name: fid,
});
```

#### blockStorage.delete({ name })

```
const isDeleted = blockStorage.delete({
name: fid,
});
```

0 comments on commit ac70ff9

Please sign in to comment.