3.0.0 • Published 3 years ago

gkc-sfbl v3.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

gkc-sfbl

Build Status

kimchi style's split file by line count moudle.

Example

const sfbl = require('gkc-sfbl')

sfbl('/var/log/abc.txt', {
  file: {
    source: {
      encoding: 'utf8', // See iconv-lite encoding. Default utf8, 
      deleteOnSuccess: false // If true, abc.txt will be deleted after split file operation is finished. Default false
    },
    split: {
      encoding: 'utf8', // This is the encoding value of the divided files. Default utf8
      lineDelimiter: '\r\n', // Line delimiter. Default \n
      eachLines: 1000, // Divides the file by 1000 lines. Default 1000
      allHasHeader: false, // The first line of abc.txt becomes the header. If the value is true, the header is placed on the first line of all divided files. Default false
      storage: './' // The directory path to store the split files. It is based on the directory path of the file to be split. In the example, /var/log is the storage. Default ./
      // storage: '../result' If you set it to ../result, it will create a directory /var/result and store the split files in /var/result.
    }
  }
})
  .then(response => {
    // response = { storage: '/var/log', splited: 6 }
    // This means that the divided files are stored in /var/log and the number of divided files is 6.
    console.log(response)
  })
  .catch(error => {
    console.error(error)
  })
  .finally(() => {
    process.exit()
  })

License

MIT

3.0.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago