proton-tools
v1.0.2
Published
A modular all-in-one toolkit for JavaScript and TypeScript projects
Maintainers
Readme
Proton
A modular all-in-one toolkit for JavaScript and TypeScript projects.
Features
- Input Creation - Text, number, boolean, select, confirm, password inputs
- File Management - Create, read, write, copy, move, delete files and directories
- NPM Package Management - Install, uninstall, update, list, search packages
- Archive Operations - ZIP and 7z archiving and extraction
- Web Utilities - HTML utilities and HTML to PDF conversion
- Wikipedia Search - Search and retrieve Wikipedia summaries
- Network Utilities - HTTP/HTTPS requests with built-in error handling
- System Information - CPU, memory, platform, and process information
- CLI - Full-featured command-line interface
Installation
npm install protonUsage
Programmatic API
import proton from 'proton';
// File Management
await proton.file_management.create('hello.txt');
await proton.file_management.write('hello.txt', 'Hello Proton');
const content = await proton.file_management.read('hello.txt');
// Input
const name = await proton.input.create({
type: 'text',
message: 'Name:'
});
// NPM
await proton.npm.install('express');
await proton.npm.uninstall('express');
await proton.npm.update('express');
// Archive
await proton.archive.zip.archive('./project', './project.zip');
await proton.archive.zip.extract('./project.zip', './output');
// Web
await proton.web.pdf.htmlToPDF('<h1>Hello</h1>', './output.pdf');
// Wikipedia
const results = await proton.wikipedia.search('JavaScript');
// Network
const response = await proton.network.get('https://api.example.com/data');
// System
const info = proton.system.getSystemInfo();CLI
# NPM operations
proton npm install express
proton npm uninstall express
proton npm update express
proton npm list
proton npm search express
# File operations
proton file create test.txt
proton file read test.txt
proton file write test.txt "Hello"
proton file delete test.txt
proton file exists test.txt
# Archive operations
proton zip archive ./src ./src.zip
proton zip extract ./src.zip ./output
proton sz archive ./src ./src.7z
proton sz extract ./src.7z ./output
# Wikipedia
proton wiki search "JavaScript"
# Web utilities
proton web html-to-pdf index.html output.pdf
# System information
proton system info
# Help and version
proton help
proton versionAPI Reference
file_management
create(path, content?)- Create fileread(path)- Read filewrite(path, content)- Write to fileappend(path, content)- Append to filecopy(source, destination)- Copy filemove(source, destination)- Move filerename(path, newName)- Rename filedelete(path)- Delete fileexists(path)- Check if file existsstat(path)- Get file statisticsdirectory.create(path)- Create directorydirectory.remove(path)- Remove directorydirectory.list(path)- List directory contentsdirectory.listDeep(path)- Recursively list directorydirectory.isEmpty(path)- Check if directory is emptydirectory.exists(path)- Check if directory exists
input
create(options)- Create user input prompt
Input Types:
text- Text inputnumber- Numeric inputboolean- Yes/No inputselect- Multiple choice selectionconfirm- Confirmation promptpassword- Password input
npm
install(package, options?)- Install packageuninstall(package, options?)- Uninstall packageupdate(package, options?)- Update packagelist(options?)- List installed packagessearch(query)- Search npm registryreadPackageJson(dir?)- Read package.jsonwritePackageJson(json, dir?)- Write package.json
archive
zip.archive(source, destination)- Create ZIP archivezip.extract(source, destination)- Extract ZIP archivesevenzip.archive(source, destination)- Create 7z archivesevenzip.extract(source, destination)- Extract 7z archive
web
html.stripTags(html)- Remove HTML tagshtml.minify(html)- Minify HTMLhtml.sanitize(html)- Sanitize HTMLhtml.extractText(html)- Extract text from HTMLhtml.escapeHtml(text)- Escape HTML entitieshtml.wrapHtml(content, options)- Wrap content in HTML templatepdf.htmlToPDF(html, path, options?)- Convert HTML to PDFpdf.fileToPDF(inputFile, path, options?)- Convert file to PDF
wikipedia
search(query)- Search WikipediagetSummary(title)- Get Wikipedia article summary
network
request(url, options?)- Make HTTP requestget(url, options?)- GET requestpost(url, body, options?)- POST requestput(url, body, options?)- PUT requestdelete(url, options?)- DELETE request
system
getPlatform()- Get OS platformgetArchitecture()- Get system architecturegetCPUCount()- Get CPU countgetCPUInfo()- Get CPU informationgetMemory()- Get memory usagegetUptime()- Get system uptimegetHostname()- Get hostnamegetHomeDir()- Get home directorygetTempDir()- Get temp directorygetSystemInfo()- Get complete system information
Special Features
Non-Symlink NPM Install
Install packages without using symlinks:
await proton.npm.install('express', { symlink: false });Custom PDF Options
await proton.web.pdf.htmlToPDF(html, './output.pdf', {
format: 'A4',
landscape: false,
margin: { top: '10mm', right: '10mm', bottom: '10mm', left: '10mm' },
printBackground: true,
});Requirements
- Node.js >= 18.0.0
zipandunzipfor ZIP operations (usually pre-installed on most systems)7zfor 7-Zip operations (optional, install via package manager)
License
MIT
