
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@sylphx/cat-file
Advanced tools
File and stream transports for @sylphx/cat logger
1.14 KB • File logging • Stream support • Universal runtime
npm install @sylphx/cat @sylphx/cat-file
Provides file-based and stream-based transports for @sylphx/cat. Write logs to files with automatic buffering, or pipe to custom streams. Works in both Bun and Node.js environments.
import { createLogger } from '@sylphx/cat'
import { fileTransport } from '@sylphx/cat-file'
const logger = createLogger({
transports: [
fileTransport({ path: './logs/app.log' })
]
})
logger.info('This goes to the file')
// Writes to ./logs/app.log
import { createLogger } from '@sylphx/cat'
import { fileTransport } from '@sylphx/cat-file'
const logger = createLogger({
transports: [
fileTransport({ path: './logs/app.log' }),
fileTransport({ path: './logs/error.log' })
]
})
// You can filter by level in your application logic
logger.info('General log') // Goes to both files
logger.error('Error log') // Goes to both files
import { createLogger } from '@sylphx/cat'
import { streamTransport } from '@sylphx/cat-file'
import { createWriteStream } from 'node:fs'
const stream = createWriteStream('./logs/app.log', { flags: 'a' })
const logger = createLogger({
transports: [
streamTransport({ stream })
]
})
logger.info('This goes to the stream')
fileTransport(options: FileTransportOptions): TransportCreates a file transport that writes logs to a file.
Options:
path: string - File path (required)mode?: number - File mode (default: 0o666)flags?: string - File open flags (default: 'a' for append)Features:
Example:
fileTransport({
path: './logs/app.log',
mode: 0o644,
flags: 'a'
})
streamTransport(options: StreamTransportOptions): TransportCreates a stream transport that writes logs to a writable stream.
Options:
stream: WritableStream - Writable stream (required)Features:
Example:
import { createWriteStream } from 'node:fs'
streamTransport({
stream: createWriteStream('./logs/app.log')
})
Both transports implement the standard Transport interface:
log(entry: LogEntry, formatted: string): void - Write a log entryflush(): Promise<void> - Flush pending writesclose(): Promise<void> - Close the transportconst logger = createLogger({
transports: [fileTransport({ path: './logs/app.log' })]
})
process.on('SIGTERM', async () => {
await logger.close() // Flushes and closes all transports
process.exit(0)
})
import { createLogger, consoleTransport } from '@sylphx/cat'
import { fileTransport } from '@sylphx/cat-file'
const logger = createLogger({
transports: [
consoleTransport(), // Console output
fileTransport({ path: './logs/app.log' }) // File output
]
})
logger.info('Logged to both console and file')
MIT © Kyle Zhu
FAQs
File and stream transports for @sylphx/cat logger
We found that @sylphx/cat-file 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.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.