1.1.5 • Published 4 years ago

gitmon v1.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

gitmon

Simple way to make your folders look like .git/objects folder.

USAGE:

Explanation:

  • First things first! Import the module.
  • The parameter to the folderize function is a string, specifying the name target folder to be generated.
  • folderize just creates a folder.
  • In the above code, path module is used to create path string.
  • Now, srcFolder has the required files which has to be converted to .git/objects folder.
  • srcFolder can also have nested folders. Only the files will be considered. i.e; all the files, no matter how deep they are in srcFolder, will be considered.
  • srcFolder can also be an Array, instead of source folder path;
  • numOfChars is an interger, which indicates the *number of characters from which the folder in targetFolder has to be named from the hash of the contents of each file in *srcFolder**.
  • The remaining characters in the hash, i.e, ((size-of-hash) - numOfChars) remaining charaters of the hash is used to name the file, whose hash is used to name the folder and the file.
  • ext is the extension of the target file.
  • HALG is a string specifying the Hashing Algorithm to be used in the process.
  • E.g, if the *srcFolder/sample.txt is the file you wish to use. Let the hash of the contents of the file be "abcded639ecb4a3ac95389bbdf05c434e4df5534"(sha1), then a folder named "ab"* will be generated in targetFolder, and the rest of the characters of the hash, i.e, "cded639ecb4a3ac95389bbdf05c434e4df5534" will be the name of the file with ext extension. To summarise, a file named "cded639ecb4a3ac95389bbdf05c434e4df5534" with extension ext can be found in *targetFolder/ab*.Hence, the relative path to the file from your working directory is *targetFolder/ab/cded639ecb4a3ac95389bbdf05c434e4df5534.*ext**.
  • In the above example numOfChars is chosen to be 2, thats why the folder is just named with only 2 characters ab.
  • If deleteSrc is true, then srcFolder will be deleted after conversion (files inside srcFolder will also be deleted), else the files and srcFolder remains untouched.

Constraints:

HALG (string) can take values which can be found in 'sha1', 'sha256', 'sha512'. ext (string) can take values which can be found in '.json', '.txt', "". numOfChars is an integer. deleteSrc is a boolean. srcFolder and targetFolder must include __dirname in path.join().

THANK YOU!

For more info, visit github repo.

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.11

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago