siwake
======

[![Build Status](https://travis-ci.org/eiurur/siwake.svg?branch=master)](https://travis-ci.org/eiurur/siwake)
[![bitHound Overall Score](https://www.bithound.io/github/eiurur/siwake/badges/score.svg)](https://www.bithound.io/github/eiurur/siwake)
[![bitHound Dependencies](https://www.bithound.io/github/eiurur/siwake/badges/dependencies.svg)](https://www.bithound.io/github/eiurur/siwake/master/dependencies/npm)
[![bitHound Dev Dependencies](https://www.bithound.io/github/eiurur/siwake/badges/devDependencies.svg)](https://www.bithound.io/github/eiurur/siwake/master/dependencies/npm)

# 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](https://github.com/eiurur/siwake/raw/master/LICENSE)