Giter Site home page Giter Site logo

node-zipper's Introduction

nodeZipper - マルチプロセスフォルダ処理

このNode.jsスクリプトは、複数のフォルダを同時にZipファイルに圧縮するために作られました。 ですが、child.jsを変更することで、他の処理にも使えるかもしれません。

前提条件

  • マシンにNode.jsがインストールされていること。
  • Node.jsと子プロセスに関する基本的な理解。

ディレクトリの要件

ターゲットディレクトリ (sourceDir) には処理したい複数のサブフォルダが含まれている必要があります。各サブフォルダは子プロセスによって処理される個別のタスクを表します。

例の構造

X:\scans\
├── folder1
├── folder2
├── folder3
└── folder4

スクリプトの設定

定数

  • sourceDir: 処理するフォルダが含まれているターゲットディレクトリ(例: "X:\\scan\\")。
  • cpuNum: 同時に実行するプロセスの数(例: 6)。

子スクリプト

各サブフォルダの処理を担当するスクリプト child.js が必要です。環境変数 filepath が各子プロセスに渡され、それぞれのサブフォルダを指します。

実行方法

  1. リポジトリをクローンするか、スクリプトファイルをローカルマシンに保存します。
  2. index.jschild.js を含むディレクトリに移動します。
  3. ターミナルを開き、以下のコマンドを実行します:
node index.js

これによりメインスクリプトが起動し、sourceDir 内のサブフォルダを読み取り、各フォルダを処理するための子プロセスを生成します。

注意事項

  • 特定の使用ケースに応じて sourceDircpuNum の定数を適宜変更してください。
  • 各サブフォルダの処理を担当する child.js スクリプトが実装されていることを確認してください。

ライセンス

このプロジェクトはMITライセンスの下でライセンスされています。

node-zipper's People

Contributors

dyamagishi avatar

Watchers

 avatar

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.