siwake

0.1.4 • Public • Published

siwake

Build Status bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies

Usage

intall

npm i siwake -S

Basic

const {Siwake} = require('siwake');

(async () => {

    const siwake = new Siwake('/path/to/output_file.txt'); 

    const dataset = [
    {
        file: '/path/to/chiya/sample.jpg',
        label: '0',
    },
    {
        directory: '/path/to/cocoa',
        label: '1',
    },
    {
        directory: '/path/to/rize',
        label: '2',
    },
    {
        directory: '/path/to/syaro',
        label: '3',
    },
    ];

    await siwake.load(dataset);

    await siwake.write(); 
    // or await siwake.write('/path/to/other_output_file.txt');

})();

output

/path/to/chiya/smplae.jpg 0 
/path/to/rize/tumblr_o58h70edb71rri82to1_1280.jpg 2 
/path/to/rize/tumblr_okod7d5hxa1r92e4to1_1280.jpg 2 
/path/to/syaro/57916490_p0.jpg 3 
/path/to/syaro/tumblr_o7f9axqwFU1qanay4o1_1280.jpg 3 
/path/to/syaro/tumblr_oibndwVrxQ1uo8t89o1_1280.jpg 3 

Change separator

const {Siwake} = require('siwake');

(async () => {

    const siwake = new Siwake('/path/to/output_file.csv', ','); 

    const dataset = [
    {
        file: '/path/to/chiya/sample.jpg',
        label: '0',
    },
    {
        directory: '/path/to/cocoa',
        label: '1',
    },
    {
        directory: '/path/to/rize',
        label: '2',
    },
    {
        directory: '/path/to/syaro',
        label: '3',
    },
    ];

    await siwake.load(dataset);

    await siwake.write(); 
    // or await siwake.write('/path/to/other_output_file.csv');

})();

output

/path/to/chiya/smplae.jpg,0 
/path/to/rize/tumblr_o58h70edb71rri82to1_1280.jpg,2 
/path/to/rize/tumblr_okod7d5hxa1r92e4to1_1280.jpg,2 
/path/to/syaro/57916490_p0.jpg,3 
/path/to/syaro/tumblr_o7f9axqwFU1qanay4o1_1280.jpg,3 
/path/to/syaro/tumblr_oibndwVrxQ1uo8t89o1_1280.jpg,3 

Setup

git clone https://github.com/eiurur/siwake.git
cd siwake
npm install

Development

Watch

npm run dev

Test

npm test

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i siwake

Weekly Downloads

0

Version

0.1.4

License

MIT

Last publish

Collaborators

  • eiurur