Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sails-script

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-script

Runner script for sails script

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sails-script

CLI to run scripts within the sails environment.

Installation

npm install sails-script -g

Requirements

Running within a sails project.

Usage

Given scripts/Example.js is your script to run,

sails-script scripts/Example.js

Script

Your script should export a function that either takes a callback as as an argument or returns a promise. If your script takes a callback as an argument, the callback can take a single error argument.

callback example

module.exports = function(cb){
  User.find({}).then(users => {
    console.log(users);
    cb();
  }).catch(err => {
    cb(err);
  });
}

promise example

module.exports = function(){
  return new Promise(async (resolve, reject) => {
    let users = await User.find({});
    console.log(users);
    resolve();
  });
}

Keywords

FAQs

Package last updated on 08 Jan 2019

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