initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

297
node_modules/isbinaryfile/test/async.test.ts generated vendored Normal file
View File

@@ -0,0 +1,297 @@
import { isBinaryFile } from '../src/index';
import * as fs from 'fs';
import * as path from 'path';
const FIXTURE_PATH = './test/fixtures';
describe('async', () => {
it('does not require size if bytes are given', async () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'grep'));
expect.assertions(1);
const result = await isBinaryFile(bytes);
expect(result).toBe(true);
});
it('should return true on a binary program, accepting path', async () => {
const file = path.join(FIXTURE_PATH, 'grep');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(true);
});
it('should return true on a binary program, accepting bytes & size', async () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'grep'));
const size = fs.lstatSync(path.join(FIXTURE_PATH, 'grep')).size;
expect.assertions(1);
const result = await isBinaryFile(bytes, { size });
expect(result).toBe(true);
});
it('should return false on a extensionless script, accepting path', async () => {
const file = path.join(FIXTURE_PATH, 'perl_script');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on a extensionless script, accepting bytes & size', async () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'perl_script'));
const size = fs.lstatSync(path.join(FIXTURE_PATH, 'perl_script')).size;
expect.assertions(1);
const result = await isBinaryFile(bytes, { size });
expect(result).toBe(false);
});
it('should return false on a russian text', async () => {
const file = path.join(FIXTURE_PATH, 'russian_file.rst');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on a zero-byte image file', async () => {
const file = path.join(FIXTURE_PATH, 'null_file.gif');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return true on a gif', async () => {
const file = path.join(FIXTURE_PATH, 'trunks.gif');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(true);
});
it('should return false on some UTF8 lua file', async () => {
const file = path.join(FIXTURE_PATH, 'no.lua');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should boom on a directory', async () => {
const file = path.join(FIXTURE_PATH, 'dir');
expect.assertions(1);
await expect(isBinaryFile(file)).rejects.toThrow('Path provided was not a file!');
});
it('should boom on non-existent file', async () => {
const file = path.join(FIXTURE_PATH, 'blahblahblbahhhhhh');
expect.assertions(1);
await expect(isBinaryFile(file)).rejects.toThrow(
"ENOENT: no such file or directory, stat 'test/fixtures/blahblahblbahhhhhh'",
);
});
it('should return true on a PDF', async () => {
const file = path.join(FIXTURE_PATH, 'pdf.pdf');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(true);
});
it('should return true on a tricky PDF that needs a header check', async () => {
const file = path.join(FIXTURE_PATH, 'test.pdf');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(true);
});
it('should return false on a protobuf.proto', async () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on a protobuf.proto.txt', async () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto.txt');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return true on a protobuf.proto.bin', async () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto.bin');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(true);
});
it('should not crash on malformed protobuf-like data (issue #80)', async () => {
const buff = Buffer.from(
'82ACE2828045E382805FE1828053E7828045E7878045E8838145E2988445E2948545E2828D4CE2828A44E28280418CF7EC2E',
'hex',
);
expect.assertions(1);
const result = await isBinaryFile(buff);
expect(typeof result).toBe('boolean');
});
it('should not crash on UTF-8 Chinese text buffer (issue #81)', async () => {
const chars = [
0xe9, 0xa2, 0x98, 0xe7, 0x9b, 0xae, 0x20, 0x20, 0x0a, 0xe2, 0x80, 0x9c, 0x37, 0x35, 0x35, 0x20,
0xe5, 0xb9, 0xb4, 0xe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 0xba, 0xa6, 0xe4, 0xbb, 0x8d,
0xe8, 0xbf, 0x90, 0xe4, 0xbd, 0x9c, 0xe3, 0x80, 0x81, 0xe5, 0x8d, 0xb4, 0xe5, 0xb7, 0xb2, 0xe5,
0xa4, 0xb1, 0xe7, 0x94, 0x9f, 0xe6, 0x88, 0x90, 0xe5, 0x8a, 0x9b, 0xe7, 0x9a, 0x84, 0xe2, 0x80,
0x9c, 0xe6, 0xb4, 0xbb, 0xe6, 0xad, 0xbb, 0xe4, 0xba, 0xba, 0xe5, 0xb8, 0x9d, 0xe5, 0x9b, 0xbd,
0xe2, 0x80, 0x9d, 0xe3, 0x80, 0x82, 0xe8, 0xae, 0xba, 0xe6, 0x96, 0x87, 0xe7, 0xbb, 0xbc, 0xe5,
0x90, 0x88, 0xe5, 0x8e, 0x86, 0xe5, 0x8f, 0xb2, 0xe7, 0xa4, 0xbe, 0xe4, 0xbc, 0x9a, 0xe5, 0xad,
0xa6, 0xe3, 0x80, 0x81, 0xe7, 0xb2, 0xbe, 0xe7, 0xa5, 0x9e, 0xe5, 0x88, 0x86, 0xe6, 0x9e, 0x90,
0xe4, 0xba, 0xba, 0xe7, 0xb1, 0xbb, 0xe5, 0xad, 0xa6, 0xe3, 0x80, 0x81, 0xe6, 0x94, 0xbf, 0xe6,
0xb2, 0xbb, 0xe7, 0xa5, 0x9e, 0xe5, 0xad, 0xa6, 0xe4, 0xb8, 0x8e, 0xe6, 0x96, 0xb0, 0xe5, 0x88,
0xb6, 0xe5, 0xba, 0xa6, 0xe4, 0xb8, 0xbb, 0xe4,
];
const buff = Buffer.from(chars);
expect.assertions(1);
const result = await isBinaryFile(buff);
expect(result).toBe(false);
});
it('should return false on a Vai script file', async () => {
const file = path.join(FIXTURE_PATH, 'vai_script.txt');
expect.assertions(1);
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false for non-UTF8 files', async () => {
const encodingDir = path.join(FIXTURE_PATH, 'encodings');
const files = fs.readdirSync(encodingDir);
for (const file of files) {
// Big5, GB, and Korean encodings require encoding hints to be detected as text.
// See encoding-hints.test.ts for tests with encoding hints.
if (!/big5/.test(file) && !/gb/.test(file) && !/kr/.test(file)) {
expect(await isBinaryFile(path.join(encodingDir, file))).toBe(false);
}
}
});
it('should return false on a UTF-8 file with emoji', async () => {
const file = path.join(FIXTURE_PATH, 'emoji.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 508', async () => {
const file = path.join(FIXTURE_PATH, '508A-4byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 3-byte sequence truncated at byte 509', async () => {
const file = path.join(FIXTURE_PATH, '509A-3byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 509', async () => {
const file = path.join(FIXTURE_PATH, '509A-4byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 2-byte sequence truncated at byte 510', async () => {
const file = path.join(FIXTURE_PATH, '510A-2byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 3-byte sequence truncated at byte 510', async () => {
const file = path.join(FIXTURE_PATH, '510A-3byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 510', async () => {
const file = path.join(FIXTURE_PATH, '510A-4byte.txt');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
it('should return false on real-world Python file with UTF-8 at boundary (utf8-boundary-truncation bug case)', async () => {
const file = path.join(FIXTURE_PATH, 'utf8-boundary-truncation_case.py');
const result = await isBinaryFile(file);
expect(result).toBe(false);
});
});

114
node_modules/isbinaryfile/test/encoding-hints.test.ts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
import { isBinaryFile, isBinaryFileSync } from '../src/index';
import * as fs from 'fs';
import * as path from 'path';
const FIXTURE_PATH = './test/fixtures';
const ENCODING_PATH = path.join(FIXTURE_PATH, 'encodings');
describe('encoding hints', () => {
describe('options API', () => {
it('should work with no options', () => {
const result = isBinaryFileSync(path.join(FIXTURE_PATH, 'grep'));
expect(result).toBe(true);
});
it('should work with options object containing size', () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'grep'));
const result = isBinaryFileSync(bytes, { size: bytes.length });
expect(result).toBe(true);
});
});
describe('UTF-16 without BOM', () => {
it('should auto-detect UTF-16LE without BOM as text', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'utf16le-no-bom.txt'));
expect(result).toBe(false);
});
it('should auto-detect UTF-16BE without BOM as text', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'utf16be-no-bom.txt'));
expect(result).toBe(false);
});
it('should detect UTF-16LE text with utf-16le hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'utf16le-no-bom.txt'), { encoding: 'utf-16le' });
expect(result).toBe(false);
});
it('should detect UTF-16BE text with utf-16be hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'utf16be-no-bom.txt'), { encoding: 'utf-16be' });
expect(result).toBe(false);
});
it('should detect UTF-16 text with generic utf-16 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'utf16le-no-bom.txt'), { encoding: 'utf-16' });
expect(result).toBe(false);
});
});
describe('Latin-1 / ISO-8859-1', () => {
it('should detect test-latin.txt as text with latin1 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'test-latin.txt'), { encoding: 'latin1' });
expect(result).toBe(false);
});
it('should detect test-latin.txt as text with iso-8859-1 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'test-latin.txt'), { encoding: 'iso-8859-1' });
expect(result).toBe(false);
});
it('should still detect binary files as binary even with latin1 hint', () => {
const result = isBinaryFileSync(path.join(FIXTURE_PATH, 'grep'), { encoding: 'latin1' });
expect(result).toBe(true);
});
});
describe('CJK encodings', () => {
it('should detect big5.txt as text with big5 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'big5.txt'), { encoding: 'big5' });
expect(result).toBe(false);
});
it('should detect big5_B.txt as text with big5 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'big5_B.txt'), { encoding: 'big5' });
expect(result).toBe(false);
});
it('should detect test-gb.txt as text with gb2312 hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'test-gb.txt'), { encoding: 'gb2312' });
expect(result).toBe(false);
});
it('should detect test-gb2.txt as text with gbk hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'test-gb2.txt'), { encoding: 'gbk' });
expect(result).toBe(false);
});
it('should detect test-kr.txt as text with euc-kr hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'test-kr.txt'), { encoding: 'euc-kr' });
expect(result).toBe(false);
});
it('should detect CJK files as text with generic cjk hint', () => {
const result = isBinaryFileSync(path.join(ENCODING_PATH, 'big5.txt'), { encoding: 'cjk' });
expect(result).toBe(false);
});
it('should still detect binary files as binary even with cjk hint', () => {
const result = isBinaryFileSync(path.join(FIXTURE_PATH, 'grep'), { encoding: 'cjk' });
expect(result).toBe(true);
});
});
describe('async API with encoding hints', () => {
it('should work with async API and encoding hints', async () => {
const result = await isBinaryFile(path.join(ENCODING_PATH, 'big5.txt'), { encoding: 'big5' });
expect(result).toBe(false);
});
it('should auto-detect UTF-16 with async API', async () => {
const result = await isBinaryFile(path.join(ENCODING_PATH, 'utf16le-no-bom.txt'));
expect(result).toBe(false);
});
});
});

View File

@@ -0,0 +1 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA测

View File

@@ -0,0 +1 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA😀

0
node_modules/isbinaryfile/test/fixtures/dir/.gitkeep generated vendored Normal file
View File

1
node_modules/isbinaryfile/test/fixtures/emoji.txt generated vendored Normal file
View File

@@ -0,0 +1 @@
UTF-8 emoji 📦

View File

@@ -0,0 +1 @@
BIG5_TW BIG5編碼繁體中文測試

View File

@@ -0,0 +1,22 @@
OpenVPN HOWTO 中文版
作者liyi 譯 文章出處openvpn 發布時間2005-09-16 點擊3435 字體: 【小 中 大】
OpenVPN HOWTO
介紹
此文檔描述一個典型的Home到Office的通信中OpenVPN的配置。這份HOWTO舉了一個完整的配置實例在man page手冊頁中有一個更為簡單的例子。
此HOWTO文檔還有如下格式
PDF
PostScript
附加的文檔
其他的一些很好的文檔及HOWTO 為不同環境下配置OpenVPN而作。
基本的隧道(Tunnel)類型
OpenVPN可以創建兩種基本的隧道類型
Routed IP tunnels -- 適用於不需廣播的點對點IP(point-to-point)通信。比起橋接網絡隧道來略顯得更有效率些而且更易配置。此HOWTO文檔涵蓋了Routed IP tunnels。
Bridged Ethernet Tunnels(橋接網絡隧道) -- 能用於IP協議或非IP協議的隧道。這種類型的隧道更適合於使用廣播(broadcast)的應用比如某些Windows網絡游戲。配置起來稍微復雜些。關於橋接網絡隧道的Mini-HOWTO。
Routed IP tunnel HOWTO
我們會嘗試描述一個完整的系統配置期間涉及到防火牆VPNNAT以及他們彼此間的相互關聯我們不會孤立的一部分一部分的探討VPN設置。

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
UTF-8 chinese UTF8格式的中文,包含中文标点符号“”。看看能不能看清楚

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD>ͨ

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD>ͨͨ<EFBFBD><EFBFBD>ͨͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -0,0 +1 @@
그런데 이렇게 굳이 글을 올리고자하는 것은

View File

@@ -0,0 +1,18 @@
-*- coding: latin-1 -*-
Mit freundlichen Grüßen
mit freundlichen Grüßen
Das ist ein Äpfel.
Was können Sie jetzt machen?
Machen wir eine Übung!
Worüber?
Darüber.
Das ist euro: €
Euro: €!
µClinux

View File

@@ -0,0 +1,2 @@
ʩʦʵʫʿ,ʶʳʯʨʬʷ,ʾʷʵ,ʱʰʮʭʺʪʯʨʬ,ʼʹʯʨʬʴ,ʵʷʫ.
ʫʦʧʨʩʺʪʫʿʫʬʮʭʮʯʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʫʿ

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
UTF-8 chinese UTF8格式的中文,包含中文标点符号“”。看看能不能看清楚

View File

@@ -0,0 +1 @@
中文

BIN
node_modules/isbinaryfile/test/fixtures/grep generated vendored Executable file

Binary file not shown.

2
node_modules/isbinaryfile/test/fixtures/no.lua generated vendored Normal file
View File

@@ -0,0 +1,2 @@
if table.get_length(baseObj.item_tbl) < 1 then return end

View File

BIN
node_modules/isbinaryfile/test/fixtures/pdf.pdf generated vendored Normal file

Binary file not shown.

2
node_modules/isbinaryfile/test/fixtures/perl_script generated vendored Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/perl
print "Hello World.\n";

View File

@@ -0,0 +1,5 @@
syntax = "proto3";
message Something {
string entry = 3687091;
}

View File

@@ -0,0 +1 @@
š«ˆ^A very long string with no suspicous characters that is currently not detected as binary proto

View File

@@ -0,0 +1 @@
entry: "A very long string with no suspicous characters that is currently not detected as binary proto"

View File

@@ -0,0 +1,49 @@
Общие сведения о программном комплексе
**************************************
test
Назначение программного комплекса
=================================
Функции программного комплекса
==============================
Требования к минимальному составу аппаратных средств
====================================================
.. Сведения о средствах, обеспечивающих выполнение программы.
Требования к минимальному составу программных средств
=====================================================
.. Сведения о средствах, обеспечивающих выполнение программы.
Требования к персоналу (системному программисту)
================================================
Структура программного комплекса
********************************
.. Сведения о структуре программы, ее составных частях, о связях между
.. составными частями и о связях с другими программами.
Настройка программного комплекса
********************************
Настройка на состав технических средств
=======================================
.. Описание действий по настройке программного комплекса на условия конкретного применения.
Настройка на состав программных средств
=======================================
.. Описание действий по настройке программного комплекса на условия конкретного
.. применения.
Проверка программного комплекса
*******************************
.. Описание способов проверки, позволяющих дать общее заключение о
.. работоспособности программного комплекса (контрольные примеры, методы прогона,
.. результаты).
Сообщения системному программисту
*********************************
.. Тексты сообщений, выдаваемых в ходе выполнения настройки, проверки
.. программы, а также в ходе выполнения программы, описание их содержания и
.. действий, которые необходимо предпринять по этим сообщениям.

BIN
node_modules/isbinaryfile/test/fixtures/test.pdf generated vendored Normal file

Binary file not shown.

BIN
node_modules/isbinaryfile/test/fixtures/trunks.gif generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -0,0 +1,32 @@
"""
测试脚本 - DDD增强网络推理
只保存预测结果,不计算指
作者: Dxxx Dexxx
日期: 2025
"""
import os
import sys
import argparse
import torch
import cv2
import numpy as np
from tqdm import tqdm
from pathlib import Path
# 添加上级目录到路径
from data import DDDEnhancerDataset
def function():
"""
保存预测结果
Args:
pred: 预测结果张量 [1, H, W] 或 [H, W],值在[0, 1]
save_path: 保存路径
original_size: 原始图像尺寸 (height, width),如果提供则调整到此尺寸
"""
pass

View File

@@ -0,0 +1,3 @@
ꕢꕎꕌ ꔖꔜꕯꕊ (1) ꕉꕜꕮ ꔔꘋ ꖸ ꔰ ꗋꘋ ꕮꕨ ꔔꘋ ꖸ ꕎ ꕉꖸꕊ ꕴꖃ ꕃꔤꘂ ꗱ, ꕉꖷ ꗪꗡ ꔻꔤ ꗏꗒꗡ ꕎ ꗪ ꕉꖸꕊ ꖏꕎ. ꕉꕡ ꖏ ꗳꕮꕊ ꗏ ꕪ ꗓ ꕉꖷ ꕉꖸ ꕘꕞ ꗪ. ꖏꖷ ꕉꖸꔧ ꖏ ꖸ ꕚꕌꘂ ꗷꔤ ꕞ ꘃꖷ ꘉꔧ ꗠꖻ ꕞ ꖴꘋ ꔳꕩ ꕉꖸ ꗳ.
ꕢꕎꕌ ꗱꕞꕯꕊ (2) ꗞ ꗏꗒ ꔰ ꕚ ꖷ ꗋꖺꕒꕌ ꖸ ꔰ ꕞ ꕺꖃ ꘈꗢ ꗏ ꗷꔤ ꕞ ꘃꖷ ꗞ ꗏ ꗓꖺ ꔰ ꔇꔀ ꕉ ꕮ, ꕉꔤ ꔳ ꗞ ꔱꔤꕮ ꖏ ꖺ ꗞ ꗬꔤꕮ ꖺ ꗞ ꕺꖃ ꕮꔧ ꕮꔕ, ꕉꔤ ꔳ ꖷꖬ ꖏ ꖺ ꕪꔤ, ꕉꔤ ꕢ ꔽꔤ ꕮ ꖺ ꔵꘉ, ꖺ ꕐꕌꔳ, ꖺ ꖏ ꘀꗫ ꕃꔤ ꖺ ꗞꗢ ꗃꕎ ꕸꖃ ꖷ ꗏ ꖺ ꗞ ꖷ ꖸ ꗏ, ꕉꔤ ꔳ ꔻꔤ ꗞꖻ ꖏ ꖺ ꔌꘋ ꕴꕱ ꗞꖻ, ꕉꔤ ꕢ ꕴꖃ ꕃꔤ ꕮ ꔧ ꖏ ꕮꔕ ꗷꔤ ꔰ. ꕉꔤ ꕒꕢ ꕉ ꔫꔤ ꕞ, ꗞ ꕮ ꗞ ꖸ ꗏ ꗓꖺ ꕮꕨ ꔻꔤ ꖏ ꗱ, ꖺ ꕢꕎꕌ ꖏ ꖴꕮ ꖺ ꗷꔤ ꖷ ꖦꖕꕰꕊ ꗪ ꗞꗢ ꕞ ꕴꖃ ꕸꖃꔀ ꗱ ꗡꕯ, ꖺ ꕐꕌꔳ ꖷ ꗏ ꗞꗢ ꗃꕎ, ꕉꔤ ꔳ ꕸꖃ ꖴꘋ ꖏ, ꔧ ꗨꗡ ꕉꕌ ꕸꖃꔀ ꗪ ꕸꖃ ꕮꔕ ꗛꖺ, ꔧ ꗨꗡ ꕉꕌ ꕸꖃꔀ ꗪ ꖴꗷ ꕢꕮ ꕒꕩ ꗏ ꖺ ꗷꔤ ꕮꔕ ꔰ ꕞ.

259
node_modules/isbinaryfile/test/sync.test.ts generated vendored Normal file
View File

@@ -0,0 +1,259 @@
import { isBinaryFileSync } from '../src/index';
import * as fs from 'fs';
import * as path from 'path';
const FIXTURE_PATH = './test/fixtures';
describe('sync', () => {
it('should require size if bytes are given', () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'grep'));
const result = isBinaryFileSync(bytes);
expect(result).toBe(true);
});
it('should return true on a binary program, accepting path', () => {
const file = path.join(FIXTURE_PATH, 'grep');
const result = isBinaryFileSync(file);
expect(result).toBe(true);
});
it('should return true on a binary program, accepting bytes & size', () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'grep'));
const size = fs.lstatSync(path.join(FIXTURE_PATH, 'grep')).size;
const result = isBinaryFileSync(bytes, { size });
expect(result).toBe(true);
});
it('should return false on a extensionless script, accepting path', () => {
const file = path.join(FIXTURE_PATH, 'perl_script');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on a extensionless script, accepting bytes & size', () => {
const bytes = fs.readFileSync(path.join(FIXTURE_PATH, 'perl_script'));
const size = fs.lstatSync(path.join(FIXTURE_PATH, 'perl_script')).size;
const result = isBinaryFileSync(bytes, { size });
expect(result).toBe(false);
});
it('should return false on a russian text', () => {
const file = path.join(FIXTURE_PATH, 'russian_file.rst');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on a zero-byte image file', () => {
const file = path.join(FIXTURE_PATH, 'null_file.gif');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return true on a gif', () => {
const file = path.join(FIXTURE_PATH, 'trunks.gif');
const result = isBinaryFileSync(file);
expect(result).toBe(true);
});
it('should return false on some UTF8 lua file', () => {
const file = path.join(FIXTURE_PATH, 'no.lua');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should boom on a directory', () => {
const file = path.join(FIXTURE_PATH, 'dir');
try {
isBinaryFileSync(file);
} catch (e: any) {
expect(e.message).toBe('Path provided was not a file!');
}
});
it('should boom on non-existent file', () => {
const file = path.join(FIXTURE_PATH, 'blahblahblbahhhhhh');
try {
isBinaryFileSync(file);
} catch (e: any) {
expect(e.message).toBe("ENOENT: no such file or directory, stat 'test/fixtures/blahblahblbahhhhhh'");
}
});
it('should return true on a PDF', () => {
const file = path.join(FIXTURE_PATH, 'pdf.pdf');
const result = isBinaryFileSync(file);
expect(result).toBe(true);
});
it('should return true on a tricky PDF that needs a header check', () => {
const file = path.join(FIXTURE_PATH, 'test.pdf');
const result = isBinaryFileSync(file);
expect(result).toBe(true);
});
it('should return false for non-UTF8 files', () => {
const encodingDir = path.join(FIXTURE_PATH, 'encodings');
const files = fs.readdirSync(encodingDir);
files.forEach((file) => {
// Big5, GB, and Korean encodings require encoding hints to be detected as text.
// See encoding-hints.test.ts for tests with encoding hints.
if (!/big5/.test(file) && !/gb/.test(file) && !/kr/.test(file)) {
expect(isBinaryFileSync(path.join(encodingDir, file))).toBe(false);
}
});
});
it('should return false on a protobuf.proto', () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on a protobuf.proto.txt', () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return true on a protobuf.proto.bin', () => {
const file = path.join(FIXTURE_PATH, 'protobuf.proto.bin');
const result = isBinaryFileSync(file);
expect(result).toBe(true);
});
it('should return false on a Vai script file', () => {
const file = path.join(FIXTURE_PATH, 'vai_script.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should not crash on malformed protobuf-like data (issue #80)', () => {
const buff = Buffer.from(
'82ACE2828045E382805FE1828053E7828045E7878045E8838145E2988445E2948545E2828D4CE2828A44E28280418CF7EC2E',
'hex',
);
const result = isBinaryFileSync(buff);
expect(typeof result).toBe('boolean');
});
it('should not crash on UTF-8 Chinese text buffer (issue #81)', () => {
const chars = [
0xe9, 0xa2, 0x98, 0xe7, 0x9b, 0xae, 0x20, 0x20, 0x0a, 0xe2, 0x80, 0x9c, 0x37, 0x35, 0x35, 0x20,
0xe5, 0xb9, 0xb4, 0xe6, 0x96, 0xad, 0xe8, 0xa3, 0x82, 0xe8, 0xae, 0xba, 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 0xe4, 0xbd, 0x9c, 0xe3, 0x80, 0x81, 0xe5, 0x8d, 0xb4, 0xe5, 0xb7, 0xb2, 0xe5,
0xa4, 0xb1, 0xe7, 0x94, 0x9f, 0xe6, 0x88, 0x90, 0xe5, 0x8a, 0x9b, 0xe7, 0x9a, 0x84, 0xe2, 0x80,
0x9c, 0xe6, 0xb4, 0xbb, 0xe6, 0xad, 0xbb, 0xe4, 0xba, 0xba, 0xe5, 0xb8, 0x9d, 0xe5, 0x9b, 0xbd,
0xe2, 0x80, 0x9d, 0xe3, 0x80, 0x82, 0xe8, 0xae, 0xba, 0xe6, 0x96, 0x87, 0xe7, 0xbb, 0xbc, 0xe5,
0x90, 0x88, 0xe5, 0x8e, 0x86, 0xe5, 0x8f, 0xb2, 0xe7, 0xa4, 0xbe, 0xe4, 0xbc, 0x9a, 0xe5, 0xad,
0xa6, 0xe3, 0x80, 0x81, 0xe7, 0xb2, 0xbe, 0xe7, 0xa5, 0x9e, 0xe5, 0x88, 0x86, 0xe6, 0x9e, 0x90,
0xe4, 0xba, 0xba, 0xe7, 0xb1, 0xbb, 0xe5, 0xad, 0xa6, 0xe3, 0x80, 0x81, 0xe6, 0x94, 0xbf, 0xe6,
0xb2, 0xbb, 0xe7, 0xa5, 0x9e, 0xe5, 0xad, 0xa6, 0xe4, 0xb8, 0x8e, 0xe6, 0x96, 0xb0, 0xe5, 0x88,
0xb6, 0xe5, 0xba, 0xa6, 0xe4, 0xb8, 0xbb, 0xe4,
];
const buff = Buffer.from(chars);
const result = isBinaryFileSync(buff);
expect(result).toBe(false);
});
it('should return false on a UTF-8 file with emoji', () => {
const file = path.join(FIXTURE_PATH, 'emoji.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 508', () => {
const file = path.join(FIXTURE_PATH, '508A-4byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 3-byte sequence truncated at byte 509', () => {
const file = path.join(FIXTURE_PATH, '509A-3byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 509', () => {
const file = path.join(FIXTURE_PATH, '509A-4byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 2-byte sequence truncated at byte 510', () => {
const file = path.join(FIXTURE_PATH, '510A-2byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 3-byte sequence truncated at byte 510', () => {
const file = path.join(FIXTURE_PATH, '510A-3byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on UTF-8 file with 4-byte sequence truncated at byte 510', () => {
const file = path.join(FIXTURE_PATH, '510A-4byte.txt');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
it('should return false on real-world Python file with UTF-8 at boundary (utf8-boundary-truncation bug case)', () => {
const file = path.join(FIXTURE_PATH, 'utf8-boundary-truncation_case.py');
const result = isBinaryFileSync(file);
expect(result).toBe(false);
});
});