New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tressohi/smlayer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tressohi/smlayer

SMLAYER JS is a library built with Parcel JS that allows developers to easily make use of [Smart Layers](https://app.smartlayers.io)-generated pipelines and models within their applications.

  • 2.0.4
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Overview

SMLAYER JS is a library built with Parcel JS that allows developers to easily make use of Smart Layers-generated pipelines and models within their applications.

Build Dist

To create build files in the dist folder, run the command below.

npx parcel build

Installing SMLAYER

For now SMLAYER can be installed by simply pointing npm install to the directory of the SMLAYER folder on your local machine just like the code below. In the future, npm install smlayer should do it.

npm install "path_to_smlayer"

Using SMLAYER

For now, the following methods are available in smlayer:

  • submit(formData) : This method allows you to upload a file to a pipeline for processing. To use it, you should have form-data installed within your project.
  • sumbitSync(formData) : This allows upload, and is obligated to wait until your result is completely processed, before returning a response. It also relies on form-data for parsing files.
  • submitFromPath(filePath) : Another method of upload, that simply requires you to just pass in the path to the file in question.
  • getAllResults() : Get all the results in a particular pipeline.
  • getSingleResult(resultId) : Get a single result from the pipeline based on its ID.

Methods in play

submit(formData)


import Pipeline from "smlayer";
import FormData from "form-data";
import * as fs from "fs";

let pipeline = new Pipeline(pipelineId, apiKey);
let formData = new FormData();

let file = fs.createReadStream(_fileLocation_);

formData.append( "file", file);
let res = await pipe.submit(formData);

console.log(res.data);

NOTE : Files to be uploaded via FormData are to be parsed with the name, "file".

submitSync(formData)


import Pipeline from "smlayer";
import FormData from "form-data";
import * as fs from "fs";

let pipeline = new Pipeline(pipelineId, apiKey);
let formData = new FormData();

let file = fs.createReadStream(_fileLocation_);

formData.append("file", file);
let res = await pipe.submitSync(formData);

console.log(res);

submitFromPath(filePath)


import Pipeline from "smlayer";

let pipeline = new Pipeline(pipelineId, apiKey);

let res = await pipe.submitFromPath(_filePath_);

console.log(res);

getAllResults()


import Pipeline from "smlayer";

let pipeline = new Pipeline(pipelineId, apiKey);

let res = await pipe.getAllResults();

console.log(res);

getSingleResult(resultId)


import Pipeline from "smlayer";

let pipeline = new Pipeline(pipelineId, apiKey);

let res = await pipe.getSingleResult(resultId);

console.log(res);

SMARTLAYERS Platform

https://app.smartlayers.io

FAQs

Package last updated on 19 Apr 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc