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

WebpackFrontendFs

This service overwrites the Jimpex default FrontendFs so it will use the file system provided by the Webpack middleware instead of using the real file system.

Constructor Summary

Public Constructor
public

Class constructor.

Member Summary

Public Members
public

A function to get the directory the Webpack middleware is using.

public

A function that returns a Promise with the virtual file system the Webpack middleware uses.

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: DevMiddlewareGetDirectory, getFileSystem: DevMiddlewareGetFileSystem) source

Class constructor.

Params:

NameTypeAttributeDescription
getDirectory DevMiddlewareGetDirectory

A function to get the directory the Webpack middleware is using.

getFileSystem DevMiddlewareGetFileSystem

A function to get the virtual file system the Webpack middleware uses. It uses a Promise in order to avoid accessing it before the middleware finishes compiling.

Public Members

public getDirectory: DevMiddlewareGetDirectory source

A function to get the directory the Webpack middleware is using.

public getFileSystem: DevMiddlewareGetFileSystem source

A function that returns a Promise with the virtual file system the Webpack middleware uses.

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>