Giter Site home page Giter Site logo

tufan-io / fs-read-data Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 1.4 MB

`fs-read-data` is a simple mechanism to read files in this one of multiple formats {json, js, yaml, ini, toml}.

License: Apache License 2.0

JavaScript 51.06% TypeScript 48.94%

fs-read-data's People

Contributors

dependabot[bot] avatar sramam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

f593

fs-read-data's Issues

require unleashes Zalgo

Hmmm...

case "js": return require(filename);

I mistakenly thought that you parsed the js file after reading it async but you just used require. :-( which is sync. Definitely need this async as it's a runtime call.

It's causing issues for me already in my app.

Not sure how to do this but maybe read/toString and then acorn parse?

TypeError: read is not a function

Thanks for this great module!
However, the API example code from the readme doesn't work, because the module exports an object with one method, instead of a function:

$ nodever fs-read-data
require('fs-read-data/package.json').version = 1.0.4
Node.js v8.12.0, npm v6.4.1, Ubuntu 14.04.5 LTS trusty,
kernel: 3.13.0-154-generic, machine/CPU/platform: i686 i686 i686

$ nodejs
> const read = require('fs-read-data');
undefined
> const data = read('package.json');
TypeError: read is not a function
> read
{ readFile: [Function] }

I'd prefer the function be exported directly. For compatibility, the function should get a readFile property with a self-reference until the next major version bump.

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.