Giter Club home page Giter Club logo

figshare.js's Introduction

Figshare

A library for interacting with Figshare API.

CLI

npm install -g figshare

figshare download [article] [dir] [--raw]

Download an article's assets and metadata to a given directory. Will create a datapackage.json by default, and uses figshare's article spec if --raw supplied.

$ figshare download 1559145 grassland_data
$ cd grassland_data/
$ ls
Ecology-Lab2-Group3-DataSet2.xlsx
datapackage.json

Also can work if you give the HTML URL link:

$ figshare download http://figshare.com/articles/Group_4_Dataset_2_Grassland_data_of_the_plant_Purple_Aster_Aster_prenathoides_/1559145

figshare search [term]

$ figshare search hello
1444470 UGH HATE FIGSHARE
1444440 Hello
1351281 <i>Shigella</i> serotypes identified in the study.
1351279 Distribution of organism identified in children with watery or bloody diarrhea by age group.
1351282 <i>Salmonella</i> serotypes identified in the study (N = 355).
1351284 Enteric Bacterial Pathogens in Children with Diarrhea in Niger: Diversity and Antimicrobial Resistance
1115016 An Adaptive Hello Messaging and Multipath Route  Maintenance in On-Demand MANET Routing Protocol
1100253 An Energy Efficient Acknowledgement Based Ids For Manet
1098621 A Beaconless Routing Approach for Energy Conservation in  Wireless Sensor Network

figshare list

$ figshare list
1444470 UGH HATE FIGSHARE
1444440 Hello
1351281 <i>Shigella</i> serotypes identified in the study.
1351279 Distribution of organism identified in children with watery or bloody diarrhea by age group.
1351282 <i>Salmonella</i> serotypes identified in the study (N = 355).
1351284 Enteric Bacterial Pathogens in Children with Diarrhea in Niger: Diversity and Antimicrobial Resistance
1115016 An Adaptive Hello Messaging and Multipath Route  Maintenance in On-Demand MANET Routing Protocol
1100253 An Energy Efficient Acknowledgement Based Ids For Manet
1098621 A Beaconless Routing Approach for Energy Conservation in  Wireless Sensor Network

JavaScript

var figshare = require('figshare')

figshare(opts)

Options:

uri: can be changed if you have your own deployment. Default 'http://api.figshare.com'

version: defaults to 1, there is only one version of figshare search

figshare.get(id, cb)

Hits the figshare api and gets the article with the given id. Will also work with the html url.

figshare.get(id, function (err, article) {
  if (err) throw err
  console.log(article)
})

figshare.download(article, dir, args, cb)

Downloads the article.

article: the article as returned by figshare.get

dir: the directory to put the data into. Will create it if it doesn't exist.

figshare.download(article, dir, args, function (err) {
  if (err) throw err
  console.error('Download complete.')
})

figshare.search(query)

var stream = figshare.stream({fulltext: 'your fulltext query text here'})
stream.on('data', function (data) {
  console.log(data.items) // each 'data' is a page from the figshare search api
})

figshare.list(query)

var stream = figshare.list()
stream.on('data', function (data) {
  console.log(data.items) // each 'data' is a page from the figshare api
})

figshare.js's People

Contributors

okdistribute avatar benwbooth avatar

Stargazers

 avatar

Watchers

 avatar Erwin Frise avatar James Cloos avatar

Forkers

loleg

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.