
Security News
White House Authorizes Private Companies to Conduct Offensive Cyber Operations
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.
@planitar/rnfs-untar
Advanced tools
rnfs-untar rnfs-untar is a utility for extracting files from TAR archives in React Native environments. This library provides both a low-level API for granular control and high-level API functions for common tasks such as listing all files, finding a specific file, and reading the entire TAR archive.
npm install @planitar/rnfs-untar
listFiles(tarFilePath: string): Promise<string[]>Lists all files in the TAR archive.
import { listFiles } from '@planitar/rnfs-untar';
listFiles('/path/to/tar/archive.tar').then(files => {
console.log('Files:', files);
});
findFile(tarFilePath: string, fileName: string | RegExp): Promise<TarFile | null>Finds a specific file in the TAR archive.
import { findFile } from '@planitar/rnfs-untar';
// Match by exact full path.
findFile('/path/to/tar/archive.tar', 'specific/file.txt').then(file => {
if (file) {
console.log('File found:', file.header.name);
console.log('File content:', (await file.read()).toString('utf-8'));
} else {
console.log('File not found.');
}
});
// Match by regexp.
findFile('/path/to/tar/archive.tar', /\bfile\.txt$/).then(file => {
if (file) {
console.log('File found:', file.header.name);
console.log('File content:', (await file.read()).toString('utf-8'));
} else {
console.log('File not found.');
}
});
readTar(tarFilePath: string, callback: (file: TarFile) => Promise<boolean | void>): Promise<void>Reads the entire TAR archive and calls the provided callback function for each file in the archive.
import { readTar } from '@planitar/rnfs-untar';
readTar('/path/to/tar/archive.tar', async (file) => {
console.log('File:', file.header.name);
console.log('Content:', (await file.read()).toString('utf-8'));
});
The low-level API provides direct access to the TarExtractor class.
import { TarExtractor } from '@planitar/rnfs-untar';
const tarExtractor = new TarExtractor();
tarExtractor.read('/path/to/tar/archive.tar', async (file) => {
console.log('File:', file.header.name);
console.log('Content:', (await file.read()).toString('utf-8'));
});
TarExtractorLow-level API for reading TAR archives.
read(tarFilePath: string, callback: (file: TarFile) => Promise<boolean | void>): Promise<void>Reads the TAR archive at the given file path and calls the provided callback function for each file in the archive.
TarFileRepresents a file in a TAR archive.
header: TarFileHeaderThe header information for the file.
read(): Promise<Buffer>Reads and returns the contents of the file as a Buffer.
TarFileHeaderRepresents the header of a file in a TAR archive.
name: stringThe name of the file.
size: numberThe size of the file.
typeFlag: stringThe type flag of the file.
ustarIndicator: stringThe ustar indicator of the file.
prefix: stringThe prefix of the file.
isPax(): booleanReturns true if the header is a PAX header, false otherwise.
FAQs
Extract files from TAR archives in React Native environments
We found that @planitar/rnfs-untar 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.

Security News
A new federal program will let vetted U.S. cybersecurity firms help investigate and disrupt foreign cybercrime groups under government direction.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.