• Version 2.1.6
  • Published
  • 60.8 kB
  • No dependencies
  • MIT license


npm i rotating-file-stream
yarn add rotating-file-stream
pnpm add rotating-file-stream


Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.



function createStream

createStream: (
filename: string | Generator,
options?: Options
) => RotatingFileStream;


    class RotatingFileStream

    class RotatingFileStream extends Writable {}


      constructor(generator: Generator, options: Opts);


        interface Options

        interface Options {}

          property compress

          compress?: boolean | string | Compressor;

            property encoding

            encoding?: BufferEncoding;

              property history

              history?: string;

                property immutable

                immutable?: boolean;

                  property initialRotation

                  initialRotation?: boolean;

                    property interval

                    interval?: string;

                      property intervalBoundary

                      intervalBoundary?: boolean;

                        property maxFiles

                        maxFiles?: number;

                          property maxSize

                          maxSize?: string;

                            property mode

                            mode?: number;

                              property path

                              path?: string;

                                property rotate

                                rotate?: number;

                                  property size

                                  size?: string;

                                    property teeToStdout

                                    teeToStdout?: boolean;

                                      Type Aliases

                                      type Compressor

                                      type Compressor = (source: string, dest: string) => string;

                                        type Generator

                                        type Generator = (time: number | Date, index?: number) => string;

                                          Package Files (1)

                                          Dependencies (0)

                                          No dependencies.

                                          Dev Dependencies (10)

                                          Peer Dependencies (0)

                                          No peer dependencies.


                                          To add a badge like this badgeto your package's README, use the codes available below.

                                          You may also use to create a custom badge linking to

                                          • Markdown
                                          • HTML
                                            <a href=""><img src="" alt=""></a>