Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
torrent-piece
Advanced tools
Also works in the browser with browserify! This module is used by WebTorrent and torrent-stream.
npm install torrent-piece
import Piece from 'torrent-piece'
Piece.BLOCK_LENGTH // 16384
const pieceLength = Piece.BLOCK_LENGTH * 5
const piece = new Piece(pieceLength)
piece.missing // 81920
piece.reserve() // 0
piece.set(0, someBuffer0)
piece.reserve() // 1
piece.reserve() // 2
piece.reserve() // 3
piece.set(1, someBuffer1)
piece.set(2, someBuffer2)
piece.set(3, someBuffer3)
piece.reserve() // 4
piece.cancel(4) // cancel the reservation of a chunk
piece.reserve() // 4 (given out again)
piece.set(4, someBuffer4)
// handy functions
piece.chunkLength(0) // 16384
piece.chunkOffset(0) // 0
// eventually, when no more chunks left...
piece.reserve() // -1 (signal that all chunks are reserved)
piece.missing // 0
const pieceBuffer = piece.flush()
console.log(pieceBuffer)
MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.
FAQs
Torrent piece abstraction
We found that torrent-piece demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.