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

orc-csv

v0.2.0

Published

Upload CSVs to Orchestrate

Downloads

5

Readme

orc-csv

Build Status Coverage Status

NPM version

Upload CSVs to Orchestrate. Comes with a simple web server for exploring datasets.

Install

npm install -g orc-csv

Usage

Upload CSVs

You can use pipes to feed orc-csv data...

cat path/to/file.csv | orc-csv -u YOUR_API_KEY -d DATACENTER_HOST -c COLLECTION_NAME

... or pass files as an argument:

orc-csv -u YOUR_API_KEY -d DATACENTER_HOST -f path/to/file.csv -c COLLECTION_NAME

Either will transform the CSV's contents into JSON objects, and upload them to Orchestrate. For example, this...

name,role,aptitude,aptitude as a cold-blooded killer
Catherine,technical writer,9,3
Diana,programmer,6,10

... would insert two documents that look like this:

{
    "name":"Catherine",
    "role":"technical writer",
    "aptitude":9,
    "aptitude as a cold-blooded killer":3
}
{
    "name":"Diana",
    "role":"programmer",
    "aptitude":6,
    "aptitude as a cold-blooded killer":10
}

Explore Data

To explore your data locally, start orc-csv's web server:

orc-csv server -u YOUR_API_KEY -d DATACENTER_HOST -c COLLECTION_NAME
# now listening on port 3000

The server proxies all requests to Orchestrate using your API key, so you can explore your data right from your browser.

Use Programmatically

You can require and use orc-csv from other packages. Install like this:

npm install orc-csv

Use like this:

var orc_csv = require('orc-csv');

// upload a file
orc_csv({
    collection: 'razzamatazz'
}).upload({
    auto_parse: true
}).file(PATH_TO_FILE)
.fin(function () {
    console.log('Upload complete');
});

// upload a stream
var stream = fs.createReadStream(PATH_TO_FILE);
orc_csv({
    collection: 'razzamatazz'
}).upload({
    delimiter: ';'
}).stream(stream)
.fin(function () {
    console.log('Upload complete');
});

// start the web server
orc_csv({
    collection: 'razzamatazz'
}).server({
    port: 5000
})
.then(function (server) {
    console.log('Listening on port 5000');
});

Both of orc_csv's upload methods return kew promises.

Options

-u, --api-key

The API key used to authenticate requests with Orchestrate. Defaults to the environment variable ORCHESTRATE_API_KEY.

-d, --datacenter

The datacenter endpoint to communicate with (i.e. api.ctl-uc1-a.orchestrate.io). Defaults to the environment variable ORCHESTRATE_API_HOST.

-f, --file

The path to the file to upload to Orchestrate.

-c, --collection

The name of the collection to upload objects to, or to read objects from if starting the web server.

-p, --port

The port to start the server on. Only used by orc-csv server.

CSV options

orc-csv supports all configuration options that node-csv-parser accepts. See them all.

For example, this sets the CSV delimiter to be ";":

orc-csv -u $API_KEY -d $DATACENTER_HOST -f $CSV_PATH --delimiter ";"

Tests

npm test

License

ASLv2