Home Reference Source
import {RollupFrontendFs} from 'projext-plugin-rollup/src/jimpex/frontendFs.js'
public class | source

RollupFrontendFs

This service overwrites the Jimpex default FrontendFs so all its methods will wait for Rollup to finish building the files before being able to read, write or delete them.

Constructor Summary

Public Constructor
public

constructor(getDirectory: RollupMiddlewareGetDirectory, getFileSystem: RollupMiddlewareGetFileSystem)

Member Summary

Public Members
public

getDirectory: RollupMiddlewareGetDirectory

A function to get the directory where Rollup is bundling the files.

public

getFileSystem: RollupMiddlewareGetFileSystem

A function to get access to the file system after Rollup finishes bundling the files.

Method Summary

Public Methods
public

Delete a file from the file system.

public

read(filepath: string, encoding: string): Promise<string, Error>

Read a file from the file system.

public

write(filepath: string, data: string): Promise<undefined, Error>

Write a file on the file system.

Public Constructors

public constructor(getDirectory: RollupMiddlewareGetDirectory, getFileSystem: RollupMiddlewareGetFileSystem) source

Params:

NameTypeAttributeDescription
getDirectory RollupMiddlewareGetDirectory

A function to get the directory where Rollup is bundling the files.

getFileSystem RollupMiddlewareGetFileSystem

A function to get access to the file system after Rollup finishes bundling the files.

Public Members

public getDirectory: RollupMiddlewareGetDirectory source

A function to get the directory where Rollup is bundling the files.

public getFileSystem: RollupMiddlewareGetFileSystem source

A function to get access to the file system after Rollup finishes bundling the files.

Public Methods

public delete(filepath: string): Promise<undefined, Error> source

Delete a file from the file system.

Params:

NameTypeAttributeDescription
filepath string

The path to the file.

Return:

Promise<undefined, Error>

public read(filepath: string, encoding: string): Promise<string, Error> source

Read a file from the file system.

Params:

NameTypeAttributeDescription
filepath string

The path to the file.

encoding string
  • optional
  • default: 'utf-8'

The text encoding in which the file should be read.

Return:

Promise<string, Error>

public write(filepath: string, data: string): Promise<undefined, Error> source

Write a file on the file system.

Params:

NameTypeAttributeDescription
filepath string

The path to the file.

data string

The contents of the file.

Return:

Promise<undefined, Error>