
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
locate-torrent-data
Advanced tools
Find the location of files that match the contents of a torrent file.
Example
var locateTorrentData = require("locate-torrent-data");
var fileIndex = locateTorrentData.index("D:\\Files");
var torrentPath = "C:\\Torrents\\memes.torrent";
fileIndex.search(torrentPath, function (error, files) {
var found = files.reduce(function (count, file) {
if (file.location) {
return count + 1;
}
return count;
}, 0);
console.log("Files found: " + found + " / " + files.length);
});
npm i locate-torrent-data
FileIndex
Create a searchable file index from the contents of specified folder(s).
Kind: static method of locate-torrent-data
Emits: error
, update
Params
string
| Array.<string>
Object
number
boolean
function
Error
Example
var fileIndex = locateTorrentData.index("D:\\Files");
FileIndex
Import a file index from disk or read from specified stream.
Kind: static method of locate-torrent-data
Emits: error
, update
See: save
Params
string
| Readable
function
Error
Example
var fileIndex = locateTorrentData.load("~/fileindex.csv");
Kind: global class
Search file index for files that match the contents of specified torrent.
Kind: instance method of FileIndex
Chainable
Emits: error
, match
, notFound
, end
, update
Params
string
| ParsedTorrent
function
TorrentFile
function
function
Error
Array.<TorrentFile>
Example
var torrentPath = "C:\\Torrents\\memes.torrent";
var savePath = "D:\\Seeding";
var torrent = parseTorrentFile(fs.readFileSync(torrentPath));
fileIndex.search(torrent, function (file, callback) {
var dest = path.join(savePath, torrent.name, file.path);
fs.rename(file.location, dest, callback);
}, function (error, files) {
if (error) {
console.error(error);
return;
}
fs.unlinkSync(torrentPath);
});
Add event listener.
Kind: instance method of FileIndex
Chainable
Params
string
function
Example
fileIndex
.on("error", function (error) {
console.error(error);
})
.on("match", function (file, torrent) {
var dest = path.join("D:\\Seeding", torrent.name, file.path);
fs.rename(file.location, dest, function () {
console.log("File located and moved: " + file.name);
});
})
.on("notFound", function (file, torrent) {
console.log("File not found: " + file.name);
})
.on("end", function (files, torrent) {
var found = files.reduce(function (count, file) {
if (file.location) {
return count + 1;
}
return count;
}, 0);
console.log("Files found: " + found + " / " + files.length);
})
.on("update", function () {
console.log("File index updated.");
});
var torrentPath = "C:\\Torrents";
fs.readdirSync(torrentPath).forEach(function (file) {
if (file.endsWith(".torrent")) {
fileIndex.search(path.join(torrentPath, file));
}
});
Add contents of specified folder(s) to the file index.
Kind: instance method of FileIndex
Chainable
Emits: error
, update
Params
string
| Array.<string>
Object
number
boolean
function
Error
Example
var fileIndex = locateTorrentData.index("D:\\Files");
fileIndex.add("D:\\Files2");
Remove contents of specified folder(s) from the file index.
Kind: instance method of FileIndex
Chainable
Emits: update
Params
string
| Array.<string>
function
Example
var fileIndex = locateTorrentData.index("D:\\Files");
fileIndex.remove("D:\\Files\\Secret Files");
Export file index as csv file to disk at specified path or write to specified stream.
Kind: instance method of FileIndex
Chainable
Emits: error
See: load
Params
string
| Writable
function
Error
Example
fileIndex.save("~/fileindex.csv");
Kind: event emitted by FileIndex
See: on
Params
Error
Kind: event emitted by FileIndex
See: on
Params
TorrentFile
ParsedTorrent
Kind: event emitted by FileIndex
See: on
Params
TorrentFile
ParsedTorrent
Kind: event emitted by FileIndex
See: on
Params
Array.<TorrentFile>
ParsedTorrent
Kind: event emitted by FileIndex
See: on
Kind: global class
Properties
number
- Offset of file inside torrent.number
- File size in bytes.string
- File name inside torrent.string
- Path of file inside torrent.string
- Location on disk of matching file if found.MPL 2.0
FAQs
Find the location of files that match the contents of a torrent file.
We found that locate-torrent-data demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.