stc-file
Virtual file for stc
Last updated 3 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 (3 years ago)

6 Versions

  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 1
This Week 13
This Month 50
Last Day 5
Last Week 37
Last Month 141
Dependencies (3)
Dev Dependencies (10)
Dependents (3)

Copyright 2014 - 2016 © taobao.org |