Installations
npm install fs-iconv
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
22.6.0
NPM Version
lerna/6.6.2/node@v22.6.0+x64 (win32)
Score
67.8
Supply Chain
90.7
Quality
76.5
Maintenance
100
Vulnerability
98.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (74.63%)
JavaScript (25.37%)
Developer
bluelovers
Download Statistics
Total Downloads
28,375
Last Day
2
Last Week
123
Last Month
705
Last Year
5,033
GitHub Statistics
2 Stars
502 Commits
3 Watching
1 Branches
11 Contributors
Bundle Size
905.56 kB
Minified
366.51 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.1.18
Package Id
fs-iconv@3.1.18
Unpacked Size
44.10 kB
Size
9.98 kB
File Count
15
NPM Version
lerna/6.6.2/node@v22.6.0+x64 (win32)
Node Version
22.6.0
Publised On
29 Aug 2024
Total Downloads
Cumulative downloads
Total Downloads
28,375
Last day
-50%
2
Compared to previous day
Last week
-4.7%
123
Compared to previous week
Last month
-0.6%
705
Compared to previous month
Last year
1.1%
5,033
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
1
fs-iconv
save file with charset/encoding/iconv
npm install fs-iconv
demo
fs same as fs-extra
1import * as fs from 'fs-iconv';
fs.saveFile
1(async ()=>
2{
3
4 /**
5 * no need set encoding
6 */
7 let big5_2 = await fs.readFile('./res/big5.txt');
8 fs.saveFile('./temp/out/_big5_2.txt', big5_2);
9
10 /**
11 * will fail if didn't set encoding
12 */
13 let big5 = "\xa6\xb8\xb1\x60\xa5\xce\xb0\xea\xa6\x72\xbc\xd0\xb7\xc7\xa6\x72\xc5\xe9\xaa\xed";
14 fs.saveFile('./temp/out/_big5.txt', big5, {
15 encoding: 'big5',
16 });
17
18})();
fs.loadFile
1fs.loadFile('./res/big5.txt', { 2 autoDecode: true, 3}) 4 .then(function (buf) 5 { 6 // autoDecode, so will try decode/encode to utf8 buffer 7 8 console.log('[autoDecode]'); 9 console.log(Buffer.isBuffer(buf), buf); 10 console.log(fs.iconv.detect(buf)); 11 console.log(buf.toString()); 12 }) 13; 14 15fs.loadFile('./res/big5.txt', { 16 encoding: 'big5', 17 }) 18 .then(function (buf) 19 { 20 // encoding is set, so will return string 21 22 console.log('[encoding:big5]'); 23 console.log(Buffer.isBuffer(buf), buf); 24 console.log(fs.iconv.detect(buf)); 25 console.log(buf.toString()); 26 }) 27; 28 29fs.loadFile('./res/big5.txt', { 30 autoDecode: ['gbk'], 31 }) 32 .then(function (buf) 33 { 34 // buf is big5, but only allow decode gbk, so skip decode/encode 35 36 console.log('[autoDecode:gbk]'); 37 console.log(Buffer.isBuffer(buf), buf); 38 console.log(fs.iconv.detect(buf)); 39 console.log(buf.toString()); 40 }) 41;
[autoDecode]
true <Buffer e6 ac a1 e5 b8 b8 e7 94 a8 e5 9c 8b e5 ad 97 e6 a8 99 e6 ba 96 e5 ad 97 e9 ab 94 e8 a1 a8>
{ encoding: 'UTF-8', confidence: 0.99, name: 'UTF-8' }
次常用國字標準字體表
[encoding:big5]
false '次常用國字標準字體表'
{ encoding: 'ascii', confidence: 1, name: 'ascii' }
次常用國字標準字體表
[autoDecode:gbk]
true <Buffer a6 b8 b1 60 a5 ce b0 ea a6 72 bc d0 b7 c7 a6 72 c5 e9 aa ed>
{ encoding: 'Big5', confidence: 0.99, name: 'Big5' }
���`�ΰ�r�зǦr���
iconv
1import { iconv } from 'fs-iconv'; 2 3import * as fs from 'fs-iconv'; 4const iconv = fs.iconv;
see iconv-jschardet
demo 2
自動判斷 檔案編碼 並且轉成 UTF8
1//import fs from 'fs-iconv'; 2import fs = require('fs-iconv'); 3import Bluebird = require('bluebird'); 4// @ts-ignore 5import globby from 'node-novel-globby/g'; 6import { EnumEncoding } from 'iconv-jschardet'; 7 8import { SymFSLib } from 'fs-iconv/core'; 9 10Bluebird.mapSeries(globby.async([ 11 '*.txt', 12], { 13 cwd: 'C:/Home/link/dist_novel/syosetu/悠閑農家與亂碼技能/00000_null', 14 absolute: true, 15}), async function (file: string) 16{ 17 let buf = await fs.loadFile(file); 18 19 /** 20 * 自動判斷 檔案編碼 並且轉成 UTF8 21 * 適合用在檔案的編碼不統一混亂時 22 * 一個一個去肉眼檢查編碼會很累人 23 */ 24 return fs.saveFile(file, buf, { 25 encoding: EnumEncoding.UTF8 26 }) 27 .tap(function () 28 { 29 console.log(file); 30 }) 31}) 32;
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
4 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-3xq5-wjfh-ppjc
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/coverage.yml:1
- Info: no jobLevel write permissions found
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/bluelovers/ws-iconv/coverage.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/bluelovers/ws-iconv/coverage.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/coverage.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/bluelovers/ws-iconv/coverage.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.8
/10
Last Scanned on 2025-01-20
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to fs-iconv
@juigorg/mollitia-sint
a library that takes two files as an input and finds any matching patterns of bytes between them (Can be very very slow)
@saoviettest/nobis-unde-inventore-repudiandae
![CI/CD](https://github.com/saoviettest/nobis-unde-inventore-repudiandae/actions/workflows/ci.yml/badge.svg) [![npm](https://img.shields.io/npm/v/@nahkies/openapi-code-generator.svg)](https://www.npmjs.com/package/@nahkies/openapi-code-generator)
@saoviettest/minus-pariatur-magnam-pariatur
> A turbo-monorepo of 130 npm packages 📦📦📦
@hutechwebsite/aliquid-ipsa-veritatis-quae
<div align="center"> <h1>jest-dom</h1>