The node library to interact with Saram
. Both Typescript and Javascipt can be used.
This library exports three main classes.
- Saram
- SaramInit
- SaramAPI
The Saram
class is primary used to interact with the Saram
server, and send it various output from commands run, files read, or script variables. This class simplifies the use of the Saram
API.
The SaramInit
class is purely intended to set the .saram.conf
file which all modules of Saram
relies on.
The SaramAPI
class exposes the entire Saram
API to be used programmatically.
npm i saramjs --save
saramJs relies of obtaining the API key and username from a local config file. To set up this config file, use:
const {SaramInit} = require('saramjs')
SaramInit('yourApiKey').init()
This will create the local creds file for you. Optionally, pass base_url
or local
to true modify the base url that is set.
// require Saram
const {Saram} = require('saramjs')
// Initialize a new Saram instance
const saram = new saramJs.Saram('someToken')
// Call any avaialble methods using
saram.methodName()
// Example: This will read the script itself and send to the server
saram.readScriptSelf().send()
// Only difference between TS and JS is how it is imported
import { Saram } from 'saramjs'
Docs are available here To generate docs using Typedoc, use
npm run docs