Socket
Socket
Sign inDemoInstall

korefile

Package Overview
Dependencies
29
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    korefile

File System API for Local/GitHub.


Version published
Weekly downloads
800
increased by13.31%
Maintainers
1
Install size
4.71 MB
Created
Weekly downloads
 

Readme

Source

korefile Actions Status: test

korefile: コレ・ファイル

File System API for Local/GitHub.

Features

  • Write/Read/Delete API for Local/GitHub
  • Pluggable adaptor

Install

Install with npm:

npm install korefile

Usage

Korefile apply KoreFileAdaptor implementation.

FsAdaptor

Read/Write/Delete for local file system. It wraps fs module.

import {createKoreFile, createFsAdaptor} from "korefile";
const koreFile = createKoreFile({ 
    adaptor: createFsAdaptor()
});
(async () => { 
    // write
    await koreFile.writeFile("/path/to/file", "content");
    // read
    const content = await koreFile.readFile("/path/to/file");
    // delete
    await koreFile.deleteFile("/path/to/file");
})()

GitHubAdaptor

Read/Write/Delete for GitHub repository. It wrap octokit/rest.js.

Require GitHub Auth Token.

import {createKoreFile, createGitHubAdaptor} from "korefile";
const koreFile = createKoreFile({
    adaptor: createGitHubAdaptor({
        owner: "azu",
        repo: "korefile",
        ref: "heads/test",
        token: process.env.GH_TOKEN
    })
});
(async () => { 
    // file path should be relative
    const testFilePath = "file.test";
    // write
    await koreFile.writeFile(testFilePath, input);
    // read
    const content = await koreFile.readFile(testFilePath);
    // delete
    await koreFile.deleteFile(testFilePath);
})();

UseCase

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

Keywords

FAQs

Last updated on 22 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc