GithubHelp home page GithubHelp logo

nodef / usda-ndb Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 48 KB

Get JSON Nutrient Data from ndb.nal.usda.gov.

Home Page: https://www.npmjs.com/package/usda-ndb

Batchfile 0.78% JavaScript 89.59% Shell 9.63%
usda ndb

usda-ndb's Introduction

usda-ndb

NPM

Get JSON Nutrient Data from USDA Nutrient Database.

Reliability improved: now with auto retries.

usda-ndb [flags] <start> <stop>
# <start>: start id (use 1 for first item in USDA NDB)
# <stop>: stop id (excluding) (note: Id <> NDB nutrient no.)
# [-o|--output]: write output to file (null)
# [-c|--connections]: maximum number of connections (4)
# [-t|--timegap]: request time gap in milliseconds (250)
# [-r|--retries]: times to retry failed requests (4)
# [-v|--verbose]: get detailed logs
# [--help]: show help

usda-ndb 1
# {"Id": "1", "Number": "01001", "Name": "Butter, salted", ...}
usda-ndb 1 100
# {"Id": "1", "Number": "01001", "Name": "Butter, salted", ...}
# {"Id": "2", "Number": "01002", "Name": "Butter, whipped, with salt", ...}
# ...
usda-ndb 0 2 --output nutrients.txt
# STDERR: ["0"]
# (["0"] is the list of failed ids)
# (id 1 is written to file)
usda-ndb 1 100 -o somanyfoods.txt -c 20 -t 512 -r 10 -v
# (try this)
var ndb = require('usda-ndb');
// ndb(<id>)

ndb('1').then((ans) => console.log(ans));
// {"Id": "1", "Number": "01001", "Name": "Butter, salted", ...}

usda-ndb's People

Contributors

dependabot[bot] avatar wolfram77 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.