Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@adze/transport-file

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adze/transport-file

AdzeJS middleware to write logs to rotating log files.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

@adze/transport-file

@adze/transport-file is a middleware plugin for AdzeJS writing logs to automatically rotating log files.

This library is built on top of file-stream-rotator and exposes most of its configuration directly with some minor differences.

Installation

# npm
npm i -S @adze/transport-file

#pnpm
pnpm add @adze/transport-file

Project Requirements

This plugin has a peer dependency on adze.

RuntimeVersion
node>= 18.19.x
bun>= 1.1.26
deno>= 1.46.3
typescript>= 5.5.2

Usage

import adze, { setup } from 'adze';
import TransportFile from '@adze/transport-file';

const fileTransport = new TransportFile({ directory: './logs' });
await fileTransport.load();

setup({
  // ...your other options
  middleware: [fileTransport],
});

Configuration

@adze/transport-file exposes all of the configuration options of file-stream-rotator directly, with an additional directory option.

If the directory option is declared, then @adze/transport-file will use it with a default log filename pattern. If the filename option is declared, then it will take precedence over the directory option. Setting directory will also simultaneously set the location of the audit.json file to be the same as the rotating log files.

To configure event callbacks, you may also provide the callback functions in the configuration.

Refer to this interface below for all additional options provided by this plugin.

interface AdzeTransportFileOptions extends Partial<FileStreamRotatorOptions> {
  /**
   * Shortcut property for defining the target log directory and audit file directory.
   */
  directory?: string;
  /**
   * Callback for hooking into the open event.
   */
  onOpen?: () => void;
  /**
   * Callback for hooking into the close event.
   */
  onClose?: () => void;
  /**
   * Callback for hooking into the error event.
   */
  onError?: (err: Error) => void;
  /**
   * Callback for hooking into the finish event.
   */
  onFinish?: () => void;
  /**
   * Callback for hooking into the rotate event when a log file is rotated.
   */
  onRotate?: () => void;
  /**
   * Callback for hooking into the new file event when a new log file is created.
   */
  onNew?: (newFile: string) => void;
  /**
   * Callback for hooking into the log removed event when a log file is removed.
   */
  onLogRemoved?: (date: number, name: string, hash: string) => void;
}

For a guide on the options, please visit the readme of file-stream-rotator: Options.

Keywords

typescript

FAQs

Package last updated on 15 Dec 2025

Did you know?

Socket

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.

Install

Related posts