https://github.com/beenotung/typestub-ipfs-only-hash
https://github.com/beenotung/typestub-ipfs-only-hash
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/beenotung/typestub-ipfs-only-hash
- Owner: beenotung
- Created: 2021-05-03T18:37:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-03T18:37:14.000Z (over 4 years ago)
- Last Synced: 2024-04-29T14:43:32.004Z (over 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# typestub-ipfs-only-hash
[](https://www.npmjs.com/package/typestub-ipfs-only-hash)Typescript declaration and wrapper for [ipfs-only-hash](https://github.com/alanshaw/ipfs-only-hash)
## Typescript Signature
```typescript
export function of (
content: string | Buffer | Stream,
): Promise
```## Usage Example
Using namespace import
```typescript
import * as Hash from 'typestub-ipfs-only-hash';(async () => {
const data = 'hello world!'
const hash = await Hash.of(data)
console.log(hash) // QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j
})()
```Or using named import:
```typescript
import { of } from 'typestub-ipfs-only-hash';(async () => {
const data = 'hello world!'
const hash = await of(data)
console.log(hash) // QmTp2hEo8eXRp6wg7jXv1BLCMh5a4F3B7buAUZNZUu772j
})()
```Details refer to [examples](./examples/index.ts)