You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

go-get-folder-size-cp

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

go-get-folder-size-cp

Get the size of a folder by recursively iterating through all its sub(files && folders). Use go, so high-speed

0.5.7
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
0
Weekly downloads
 
Created
Source

go-get-folder-size

go concurrently get folder size quickly, can run in nodejs


README 🦉

简体中文 | English


features


motivation

I want to know the folder size quickly, but the nodejs implementation of get-folder-size is slow, so using go implements a recursive get folder size that runs in nodejs and is 7 ~ 20 times faster than the node native solution under normal circumstances。


Usage

npm

install

npm install go-get-folder-size

cli

# Binary go, fastest
npx go-get-folder-size

program

import {
  getFolderSize,
  getFolderSizeBin,
  getFolderSizeWasm,
} from "go-get-folder-size";

const base = "./"; // The directory path you want to get

await getFolderSizeBin(base); // Binary go, fastest

await getFolderSize(base); // native node

await getFolderSizeWasm(base); // Wasm go,slowest
IPC

Suitable for multi-path

import { createGetFolderSizeBinIpc } from "go-get-folder-size";

const { getFolderSizeWithIpc, close } = createGetFolderSizeBinIpc();

Promise.all([
  getFolderSizeWithIpc("./"),
  getFolderSizeWithIpc("../"),
])
  .then((vs) => console.log(vs))
  .finally(close); // Manual close is required

go

cli

go install github.com/markthree/go-get-folder-size
go-get-folder-size

program

# Super invincible fast
go get github.com/markthree/go-get-folder-size
package main

import (
	getFolderSize "github.com/markthree/go-get-folder-size/src"
)

func main() {
	size, err := getFolderSize.Invoke("./") // Concurrent running, invincible fast

  size2 := getFolderSize.LooseInvoke("./") // Sometimes we may encounter inaccessible files, and we can set 'loose' to ignore them
}

loose

Sometimes we may encounter inaccessible files, and we can set loose to ignore them

cli

go-get-folder-size --loose

program

import {
  getFolderSize,
  getFolderSizeBin,
  getFolderSizeWasm,
} from "go-get-folder-size";

const base = "./"; // The directory path you want to get
const pretty = false; // Human readable way
const loose = true;

await getFolderSizeBin(base, pretty, { loose }); // Binary go, fastest

await getFolderSize(base, pretty, { loose }); // native node

await getFolderSizeWasm(base, pretty, { loose }); // Wasm go,slowest

stack


License

Made with markthree

Published under MIT License.

Keywords

go

FAQs

Package last updated on 14 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts