npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

synwave

v1.0.4

Published

SynWave API Client

Downloads

11

Readme

NPM package for SynWave API

Command line tool

Installation

$ npm install -g synwave

Usage:

$ synwave help


    SynWave Command Line tool. https://synwave.io.

    Actions:

        upload: Uploads a new file into SynWave service.

            $ synwave upload filename [--expiration value] [--download_limit value] [--auth_username username --auth_password password]
            
            Options:
                --expiration value: Number of seconds after the file will become unavailable.
                --download_limit value: Number of time the file can be downloaded until it becomes unavailable.
                --auth_username value: Username to protect this file. --auth_password is required if username is set.
                --auth_password value: Password to protect this file. --auth_username is required if password is set.

                Example: 
                    $ synwave upload myfile.txt --expiration 3600


        list: Lists files stored on SynWave service.

            $ synwave list


        account: Shows a summary with account information.

            $ synwave account
            

        delete: Delete a file store on SynWave service.
 
            $ synwave delete [file_id]


        help: Shows this help.

    Global flags:
        --debug: Shows API responses
    

Library

Installation:

$ npm install -s synwave

Prepare a file to upload to Synwave API.

$ cat << EOF > sample.html
<h1>hi there</h1>
EOF

Create main.js with the following content to upload sample.html:

const synwave = require('synwave');

// All are optional
const synwaveOptions = {
    download_limit: 15,
    expiration_seconds: 90,
    auth_username: 'my_username',
    auth_password: 'my_secret_password'
};

(async function main() {
    try {
        let r = await synwave.uploadFile('./sample.html', synwaveOptions)
        console.log('Response API')
        console.log(r)
        console.log(`File published at ${r.file.address}`)
    } catch (e) {
        console.warn(e)
    }
})()
$ node main.js

Response API
{
  success: true,
  file: {
    id: 'iL4w5pv46jnJEe5oAdl21Jqm59pEDR1JQ0XoqYQl3SO-P_ZXP8s0KU5EhZTPHAWb',
    address: 'https://synwave.io/t/iL4w5pv46jnJEe5oAdl21Jqm59pEDR1JQ0XoqYQl3SO-P_ZXP8s0KU5EhZTPHAWb',
    size_bytes: 18,
    created_at: '2023-10-07T16:03:48.351Z',
    mimetype: 'text/html',
    filename: 'sample.html',
    expiration_time: '2023-10-07T16:05:18.000Z',
    downloads_remaining: 15,
    authentication: { username: 'my_username', password: 'my_secret_password' }
  }
}
File published at https://synwave.io/t/iL4w5pv46jnJEe5oAdl21Jqm59pEDR1JQ0XoqYQl3SO-P_ZXP8s0KU5EhZTPHAWb

Library functions

  • uploadFile(fileLocation, synwaveOptions) - Uploads a new file.

    fileLocation: Path of local file to upload.

    synwaveOptions: Optional. An object with the following keys:

    • download_limit: Number of downloads before the file becomes unavailable.
    • expiration_seconds: Number of seconds before the file becomes unavailable.
    • auth_username: Username to protect this file. auth_password parameter is required if auth_username is set.
    • auth_password Password to protect this file. auth_username parameter is required if auth_password is set.