https://github.com/nodef/nutritionvalue-searchall
Get JSON Nutrient Data from NutritionValue.org.
https://github.com/nodef/nutritionvalue-searchall
nutrition-value search-all
Last synced: 27 days ago
JSON representation
Get JSON Nutrient Data from NutritionValue.org.
- Host: GitHub
- URL: https://github.com/nodef/nutritionvalue-searchall
- Owner: nodef
- Created: 2017-10-16T19:48:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T16:35:58.000Z (about 1 year ago)
- Last Synced: 2025-09-24T05:38:27.990Z (9 months ago)
- Topics: nutrition-value, search-all
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/nutritionvalue-searchall
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nutritionvalue-searchall
[](https://nodei.co/npm/nutritionvalue-searchall/)
Get JSON Nutrient Data from [NutritionValue].
> Reliability improved: now with auto retries.
```bash
nutritionvalue-searchall [flags]
# : start id (use 1001 for first item in NutritionValue)
# : stop id (excluding) (note: Id == 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
nutritionvalue-searchall 1001
# {"Id": "1001", "Number": "1001", "Name": "Butter, salted", ...}
nutritionvalue-searchall 1001 1100
# {"Id": "1001", "Number": "1001", "Name": "Butter, salted", ...}
# {"Id": "1002", "Number": "1002", "Name": "Butter, whipped, with salt", ...}
# ...
nutritionvalue-searchall 1000 1002 --output nutrients.txt
# STDERR: ["1000"]
# (["1000"] is the list of failed ids)
# (id 1001 is written to file)
nutritionvalue-searchall 1001 1100 -o somanyfoods.txt -c 20 -t 512 -r 10 -v
# (try this)
```
```javascript
// using as a javascript module
var searchall = require('nutritionvalue-searchall');
// searchall()
searchall('1001').then((ans) => console.log(ans));
// {"Id": "1001", "Number": "1001", "Name": "Butter, salted", ...}
```
[NutritionValue]: https://www.nutritionvalue.org
