
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Toolkit Node.js tanpa dependensi: HTTP cepat, HTML parser, tanggal, IP, storage, DB lokal, JSON utils, CLI, auth, CORS, parsing & convert, ffmpeg wrapper, dan 15+ util tingkat lanjut.
Toolkit Node.js tanpa dependensi. Cepat, sederhana, dan lengkap.
npm i xoo-tools not work?
try this : npm install xoo-tools --no-bin-links
const xoo = require('xoo-tools')
const xoo = require('xoo-tools')
const { request } = xoo
async function run() {
const r1 = await request.get('https://httpbin.org/get', { responseType: 'json' })
console.log(r1.status, r1.headers, r1.data)
const r2 = await request.post(
'https://httpbin.org/post',
{ hello: 'world' },
{ responseType: 'json', timeout: 5000 }
)
console.log(r2.status, r2.data)
const r3 = await request('https://httpbin.org/gzip', { responseType: 'text', maxRedirects: 5 })
console.log(r3.status)
const r4 = await request('https://example.com', { method: 'HEAD' })
console.log(r4.status)
}
run()
const xoo = require('xoo-tools')
const { html } = xoo
const $ = html.load('<div id="app"><p class="x">Hello</p><a href="/a">Link</a></div>')
const nodes = $.find('#app .x')
console.log(nodes.length)
console.log(html.textContent(nodes[0]))
const xoo = require('xoo-tools')
const { regex } = xoo
const allMatches = regex.matchAll('a1 b22 c333', /\d+/g).map(x => x[0])
const extracted = regex.extract('user:42', /user:(\d+)/, 1)
const isValid = regex.testMany('hello@example.com', [regex.patterns.email])
const replaced = regex.replaceMany('visit http://x.com', [[/https?:\/\/\S+/g, '<url>']])
const stripped = regex.stripTags('<b>ok</b>')
console.log(allMatches)
console.log(extracted)
console.log(isValid)
console.log(replaced)
console.log(stripped)
const { date } = xoo
console.log(date.format(new Date(), 'YYYY-MM-DD HH:mm:ss'))
console.log(date.fromNow(new Date(Date.now() - 65000)))
const xoo = require('xoo-tools')
const run = async () => {
console.log(await xoo.ip.getPublicIP())
}
run()
const xoo = require('xoo-tools')
async function run() {
const { storage } = xoo
await storage.write('data/test.txt', 'hello')
console.log(await storage.read('data/test.txt'))
console.log(await storage.exists('data/test.txt'))
await storage.jsonWrite('data/test.json', { a: 1 })
console.log(await storage.jsonRead('data/test.json'))
console.log(storage.join('data', 'foo', 'bar'))
await storage.copy('data/test.txt', 'data/test-copy.txt')
await storage.move('data/test-copy.txt', 'data/moved.txt')
console.log(await storage.list('data', { recursive: true }))
await storage.remove('data/moved.txt')
}
run()
const xoo = require('xoo-tools')
const { db } = xoo
const { LocalDB } = db
const store = new LocalDB('./mydb.json')
async function main() {
await store.init()
await store.set('user:1', { name: 'A', age: 20 })
const user1 = await store.get('user:1')
const adults = await store.find(({ value }) => value.age >= 18)
const queryResult = await store.query({
where: ({ value }) => value.age >= 18,
map: ({ key, value }) => ({ id: key, ...value })
})
console.log(user1)
console.log(adults)
console.log(queryResult)
}
main()
const xoo = require('xoo-tools')
const { jsonUtils } = xoo
const obj = { b: 1, a: { d: 2, c: 3 } }
console.log(jsonUtils.sortKeys(obj))
console.log(jsonUtils.pick({ a: 1, b: 2 }, ['a']))
console.log(jsonUtils.omit({ a: 1, b: 2 }, ['b']))
const xoo = require('xoo-tools')
const { cli } = xoo
async function main() {
const name = await cli.prompt('Enter Name: ')
const pass = await cli.password('Enter Password: ')
const ok = await cli.confirm('Next? (y/N) ')
const choice = await cli.select('Pilih:', ['one', 'two', 'thre'])
console.log({ name, pass, ok, choice })
}
main()
const xoo = require('xoo-tools')
const { auth } = xoo
const hashed = auth.hashPassword('hello')
console.log('Hash:', hashed)
console.log('Verify:', auth.verifyPassword('hello', hashed))
const token = auth.signToken({ uid: 1 }, 'secret', { expiresIn: 3600 })
console.log('Token:', token)
console.log('Verify Token:', auth.verifyToken(token, 'secret'))
const xoo = require('xoo-tools')
const http = require('http')
const cors = xoo.cors({ origin: '*', credentials: true })
http.createServer((req, res) => {
if (cors(req, res)) return
res.setHeader('content-type', 'application/json')
res.end(JSON.stringify({ ok: true }))
}).listen(3000, () => {
console.log('Server running on http://localhost:3000')
})
const xoo = require('xoo-tools')
const { convert } = xoo
const b64 = convert.toBase64('hello')
console.log('Base64:', b64)
console.log('From Base64:', convert.fromBase64(b64).toString('utf8'))
console.log('Bytes Format:', convert.bytesFormat(123456))
const csv = convert.csvStringify([{ a: 1, b: 'x' }, { a: 2, b: 'y' }])
console.log('CSV Stringify:\n', csv)
console.log('CSV Parse:', convert.csvParse(csv))
const xoo = require('xoo-tools')
const { ffmpeg } = xoo
;(async () => {
const result = await ffmpeg.run(['-version'])
console.log(result)
})()
const xoo = require('xoo-tools')
const ytsearch = xoo.ytsearch
;(async () => {
const results = await ytsearch('lofi')
console.log(results)
})()
const xoo = require('xoo-tools')
const { cache } = xoo
const { LRUCache } = cache
const c = new LRUCache({ max: 3, ttl: 1000 })
c.set('a', 1)
c.set('b', 2)
c.set('c', 3)
console.log('Get a:', c.get('a'))
c.set('d', 4)
console.log('Keys after eviction:', c.keys())
const xoo = require('xoo-tools')
const { queue } = xoo
const { TaskQueue } = queue
;(async () => {
const q = new TaskQueue({ concurrency: 2, timeout: 2000 })
q.add(async (n) => n * 2, 2).then(console.log) // -> 4
q.add(async () => new Promise(r => setTimeout(() => r('slow'), 300))).then(console.log) // -> slow
await q.onIdle()
console.log('All tasks done!')
})()
const xoo = require('xoo-tools')
const { retry } = xoo
;(async () => {
let i = 0
const v = await retry.retry(async () => {
i++
if (i < 3) throw new Error('fail')
return 'ok'
}, { retries: 5, minTimeout: 50, factor: 2 })
console.log('Result:', v)
})()
const xoo = require('xoo-tools')
const { logger } = xoo
;(async () => {
const log = logger.createLogger({ level: 'debug', name: 'app' })
log.info('start')
const end = log.time('work')
await new Promise(r => setTimeout(r, 100))
end()
log.warn('done', { code: 200 })
})()
const xoo = require('xoo-tools')
const { validator } = xoo
const schema = validator.object({
email: validator.string({ pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ }),
age: validator.number({ min: 18, integer: true }),
tags: validator.array(validator.string({ min: 1 }), { min: 1 })
})
console.log(schema({ email: 'a@b.com', age: 20, tags: ['x'] }))
const xoo = require('xoo-tools')
const { crypto } = xoo
console.log('SHA256:', crypto.hashSha256('x'))
console.log('HMAC:', crypto.hmacSha256('k', 'x'))
console.log('UUID:', crypto.uuid())
const s = crypto.signToken({ id: 1 }, 'secret', { expSec: 60 })
console.log('Token:', s)
console.log('Verify:', crypto.verifyToken(s, 'secret'))
const xoo = require('xoo-tools')
const { urlUtils } = xoo
console.log(urlUtils.parseQuery('?a=1&b=2'))
console.log(urlUtils.stringifyQuery({ q: 'hello world', page: 2 }))
console.log(urlUtils.buildURL('https://x.com?a=1', { b: 2 }))
console.log(urlUtils.joinURL('https://x.com/', '/a/', '/b'))
const xoo = require('xoo-tools')
const { fileWatch } = xoo
const w = fileWatch.watch('./data', { recursive: true })
w.on('change', (e) => console.log('change', e))
setTimeout(() => w.close(), 5000)
const xoo = require('xoo-tools')
const { env } = xoo
env.load('.env')
env.required(['API_KEY'])
console.log(env.get('API_KEY'))
console.log(env.bool('DEBUG', false))
console.log(env.int('PORT', 3000))
const xoo = require('xoo-tools')
const { tokenizer } = xoo
console.log(tokenizer.normalize('Ábç'))
console.log(tokenizer.slugify('Hello World!!'))
console.log(tokenizer.words('Hello, world! 123'))
console.log(tokenizer.sentences('Hi. Apa kabar? Oke!'))
const xoo = require('xoo-tools')
const { mime } = xoo
const fs = require('fs')
console.log(mime.lookupByExt('file.jpg'))
const buf = fs.readFileSync(__filename)
console.log(mime.sniff(buf))
const xoo = require('xoo-tools')
const { csv } = xoo
const s = csv.stringify([{ a: 1, b: 'x' }, { a: 2, b: 'y' }])
console.log(s)
console.log(csv.parse(s, { header: true }))
const xoo = require('xoo-tools')
const { xml } = xoo
const node = xml.parse('<a id="x"><b>c</b></a>')
console.log(JSON.stringify(node))
const xoo = require('xoo-tools')
const { scheduler } = xoo
const job = scheduler.schedule('* * * * *', () => console.log('tick'))
setTimeout(() => job.stop(), 3100)
const xoo = require('xoo-tools')
const { compress } = xoo
;(async () => {
const gz = await compress.gzip('hello')
console.log((await compress.gunzip(gz)).toString())
const br = await compress.brotliCompress('hello')
console.log((await compress.brotliDecompress(br)).toString())
})()
npx xoo-tools
FAQs
Toolkit Node.js tanpa dependensi: HTTP cepat, HTML parser, tanggal, IP, storage, DB lokal, JSON utils, CLI, auth, CORS, parsing & convert, ffmpeg wrapper, dan 15+ util tingkat lanjut.
The npm package xoo-tools receives a total of 195 weekly downloads. As such, xoo-tools popularity was classified as not popular.
We found that xoo-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.