stc-file
Virtual file for stc
Last updated 4 years ago by welefen .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install stc-file 
SYNC missed versions from official npm registry.

stc-file

Virtual File for stc

How to use

import File from 'stc-file';

let file = new File({
  cwd: '', //current work path
  base: '', //base name
  path: 'path/to/file', //file path
  stat: null //file stat
});

API

path

get or set file path.

file.path = 'xxx';
file.path; 

extname

get or set file extname.

file.extname; // html
file.extname = 'txt'; //

stat

get or set file stat.

let stat = file.stat;
file.stat = stat;

isFile()

let isFile = file.isFile();

isDirectory()

let isDirectory = file.isDirectory();

pipe(stream, opt)

pipe file stream to another stream.

file.pipe(stream, {
  end: true
});

isPath(filepath)

check file path

getContent(encoding)

get file content,

  • encoding default is null

setContent(content)

hasAst()

check file aleady have ast

getAst()

setAst(ast)

prop(name, value)

get or set other property for file

Current Tags

  • 1.0.5                                ...           latest (4 years ago)

6 Versions

  • 1.0.5                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.2                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 10
This Week 28
This Month 71
Last Day 12
Last Week 39
Last Month 165
Dependencies (3)
Dev Dependencies (10)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |