UNPKG

tar-iterator

Version:

Extract contents from tar archive type using an iterator API using streams or paths. Use stream interface and pipe transforms to add decompression algorithms

24 lines (23 loc) 801 B
/** * TAR Error Codes for programmatic error handling * * Node 0.8 compatible - uses let and object literals. */ /** * Error with a code property for programmatic handling */ /** * TAR-specific error codes for user-facing errors */ export const TarErrorCode = { /** Invalid tar header checksum - archive may be corrupted or needs decompression */ INVALID_CHECKSUM: 'TAR_INVALID_CHECKSUM', /** Unknown tar format - not USTAR, GNU, or V7 */ INVALID_FORMAT: 'TAR_INVALID_FORMAT' }; /** * Create an error with a code property * * @param message - Human-readable error message * @param code - Error code from TarErrorCode * @returns Error with code property */ export function createTarError(message, code) { const err = new Error(message); err.code = code; return err; }