Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-get-folder-size 递归获取文件夹大小,足够快,可以跑在 go 和 nodejs 中 #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markthree
Copy link

cli

我们同样用 cli 计算 184,046 个文件,35,185 个文件夹,共 7 GB 左右的目录

node 实现的 get-folder-size,要 11.5s 👇

image

用 go 重写的 go-get-folder-size,只需要 1.7s

image

program

也支持 nodejs 和 go 程序式调用

支持 nodejs

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

const base = './' // 你想要获取的目录

await getFolderSizeBin(base) // 二进制 go,最快

await getFolderSize(base) // 原生 node

await getFolderSizeWasm(base) // Wasm go,最慢 🥵

支持 go

package main

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

func main() {
	size, err := getFolderSize.Parallel("./") // 并发计算,超级快
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant