# glitter-sdk-js

> A light client which talks to your Glitter over Http

Latest version **0.1.4** (published 2022-05-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install glitter-sdk-js
pnpm add glitter-sdk-js
yarn add glitter-sdk-js
bun add glitter-sdk-js
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2022-05-01 |
| First published | 2022-04-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.1 MB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | glitter |
| Maintainers | rongnpm |
| Keywords | glitter |

## Links

- npm: https://www.npmjs.com/package/glitter-sdk-js
- npm.io page: https://npm.io/package/glitter-sdk-js

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.19.0

## Recent versions

- 0.1.4 (latest) — 2022-05-01
- 0.1.3 — 2022-04-10
- 0.1.2 — 2022-04-08

## README

# glitter-sdk-js

> glitter sdk for node

## Quick Start

```sh
npm install glitter-sdk-js
```

```js
  // create sdk
  let GlitterSdk = require('glitter')
  const client = new GlitterSdk()
  const db = client.db

  // put document
  const docValue = `{
    "doi": "10.1003/(sci)1099-1697(199803/04)7:2<65::aid-jsc357>3.0.c",
    "title": "British Steel Corporation: probably the biggest turnaround story in UK industrial history",
    "ipfs_cid": "bafybeibxvp6bawmr4u24vuza2vyretip4n7sfvivg7hdbyolxrvbodwlte"
  }`
  try {
    const txID = db.put_doc('demo', docValue)
    console.log(`tx id=${txID}`) 
  } catch (error) {
    console.log(error)
  }

  // search document
  try {
    const res = db.search('libgen', "British Steel", ["doi"], ["title"], 'desc', 1, 10)
    console.log(`res=${res}`) 
  } catch (error) {
    console.log(error)
  }
```

## SDK
### Options

|Option|Description|
|----|----|
|WithAddrs(address ...string)|set glitter address|
|WithAccessToken(token string)|set glitter token|
|WithTimeout(timeout time.Duration)|set client timeout|

## API

See [node-sdk.md](./docs/node-sdk.md)

## More useage

See [lightNode.js](./example/lightNode.js)

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