
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
js-use-core
Advanced tools
JavaScript Comprehensive tool library, including full screen, copy and paste functions
🚩 支持 JS(浏览器)、Vue(兼容 Vue2)、React、Node.js 多端环境
一个现代化的 JavaScript 综合工具库,提供全屏、剪贴板、文件处理、字体管理、URL 操作、设备检测和 User Agent 解析等功能。采用统一的架构设计,支持 TypeScript,具有完善的错误处理和性能监控。
npm install js-use-core
import {
FullscreenManager,
ClipboardManager,
FontManager,
UrlManager,
DeviceDetector,
UA
} from 'js-use-core';
// 全屏管理
const fullscreen = new FullscreenManager();
await fullscreen.initialize();
await fullscreen.request();
// 剪贴板操作
const clipboard = new ClipboardManager();
await clipboard.initialize();
await clipboard.copyText('Hello World!');
// 字体管理
const fontManager = new FontManager();
await fontManager.initialize();
const result = await fontManager.check('Arial');
// URL 操作
const urlManager = new UrlManager('https://example.com');
urlManager.addQuery({ page: 1, size: 10 });
// 设备检测
const device = new DeviceDetector();
await device.initialize();
console.log(device.isMobile);
// User Agent 解析
const ua = UA.parse(navigator.userAgent);
console.log(ua.browser.name, ua.browser.version);
提供跨浏览器兼容的全屏 API,支持元素全屏、状态监听和错误处理。
import { FullscreenManager } from 'js-use-core';
const fullscreen = new FullscreenManager({
enablePerformanceMonitoring: true,
timeout: 5000
});
await fullscreen.initialize();
await fullscreen.request(document.getElementById('video'));
支持文本、HTML、文件的复制和粘贴,具有权限管理和降级处理。
import { ClipboardManager } from 'js-use-core';
const clipboard = new ClipboardManager({
enablePermissionCheck: true,
enableFallback: true
});
await clipboard.initialize();
await clipboard.copyText('要复制的文本');
const text = await clipboard.readText();
字体加载检测、动态字体管理和跨域处理。
import { FontManager } from 'js-use-core';
const fontManager = new FontManager({
timeout: 3000,
enableCache: true
});
await fontManager.initialize();
fontManager.addFont('CustomFont', '/fonts/custom.woff2');
const result = await fontManager.check(['Arial', 'CustomFont']);
文件读取、写入、下载和上传功能。
import { FileManager } from 'js-use-core';
const fileManager = new FileManager();
await fileManager.initialize();
const content = await fileManager.readAsText(file);
URL 解析、构建和查询参数处理。
import { UrlManager } from 'js-use-core';
const url = new UrlManager('https://example.com/api');
url.addQuery({ page: 1, filter: 'active' });
console.log(url.toString());
设备类型检测、操作系统识别和浏览器检测。
import { DeviceDetector } from 'js-use-core';
const device = new DeviceDetector();
await device.initialize();
console.log({
isMobile: device.isMobile,
isTablet: device.isTablet,
os: device.os,
browser: device.browser
});
User Agent 字符串解析、版本比较和生成。
import { UA } from 'js-use-core';
const ua = UA.parse(navigator.userAgent);
const isModern = UA.satisfies(ua, 'Chrome >= 100');
console.log(ua.browser.name, ua.browser.version);
DOM 操作、浏览器兼容性和通用工具函数。
import { isElement, debounce, throttle } from 'js-use-core';
if (isElement(element)) {
// DOM 操作
}
const debouncedFn = debounce(callback, 300);
const throttledFn = throttle(callback, 100);
浏览器 | 版本 | 支持 |
---|---|---|
Chrome | 66+ | ✅ |
Firefox | 63+ | ✅ |
Safari | 13.1+ | ✅ |
Edge | 79+ | ✅ |
IE | 不支持 | ❌ |
所有管理器都支持统一的基础配置:
const options = {
debug: false, // 调试模式
timeout: 5000, // 操作超时时间
retries: 2, // 重试次数
cache: true, // 启用缓存
cacheTTL: 30000 // 缓存过期时间
};
// 旧版本
import { fullscreen } from 'js-use-core';
// 新版本
import { FullscreenManager } from 'js-use-core';
const fullscreen = new FullscreenManager();
await fullscreen.initialize();
详细迁移指南请参考 MIGRATION.md
欢迎贡献代码!请查看 CONTRIBUTING.md 了解详情。
# 克隆项目
git clone https://github.com/chao921125/js-use-core.git
# 安装依赖
npm install
# 运行测试
npm test
# 构建项目
npm run build
MIT License - 详见 LICENSE 文件
FAQs
JavaScript Comprehensive tool library, including full screen, copy and paste functions
The npm package js-use-core receives a total of 104 weekly downloads. As such, js-use-core popularity was classified as not popular.
We found that js-use-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.