Socket
Socket
Sign inDemoInstall

s4-client

Package Overview
Dependencies
23
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    s4-client

Client library for S4 (Simple (time)series storage service)


Version published
Maintainers
1
Created

Readme

Source

s4-client

Installation

yarn add @propelleraero/s4-client

Usage

Basic Example

import { S4Client, BaseUrl, TableRecord } from 's4-client';

const baseUrl = BaseUrl.STAGING;
const consumer = 'cool-app-name';
// "S4 staging API key" / "S4 production API key" in 1password
const secretKey = '...';

const client = new S4Client(baseUrl, consumer, secretKey);

// Insert records
const tableName = 'debug';
const partitionKey = 'sensor123';
const records: TableRecord[] = [
    {
        timestamp: Date.now(),
        value: 'cool string',
    },
    {
        timestamp: Date.now() + 1000,
        value: 'another cool string',
    },
];

const insertResponse = await client.insertRecords(
    tableName,
    partitionKey,
    records
);
console.log(insertResponse);

// Retrieve records
const start = records[0].timestamp;
const end = start + 10 * 1000;
const queryResponse = await client.retrieveRecords(
    tableName,
    partitionKey,
    start,
    end
);
console.log(queryResponse);

FAQs

Last updated on 02 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc