Socket
Socket
Sign inDemoInstall

ack-path

Package Overview
Dependencies
18
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ack-path

Operating system directory functionality


Version published
Maintainers
1
Created

Changelog

Source

[1.5.2] - 2017-03-17

  • docs and better names. old names still supported

Readme

Source

ack-path

Operating system directory functionality

Table of Contents

Directory Functionality

require

var Path = require('ack-path')(__dirname)
var stringPath = Path.path

.join()

write file promise

Path.join('file-name.js').writeFile(string).then().catch()

.param()

Create directory if not existant. Does not take into condsideration if path is actually a file (file path will be created as a folder)

Path.param().then()

.paramDir()

Create directory if not existant. Takes condsideration if path is actually a file and only creates folder pathing

Path.paramDir().then()

.copyTo()

Path.copyTo(__dirname+'-copy').then()

.delete()

path delete promise

Path.delete().then()

.eachFilePath()

Loop folder to fire callback for each file found. Only produces file results. see eachPath function

Path.eachFilePath(filePath=>console.log('file', filePath))

.recurFilePath()

Recursively loop folder to fire callback for each file found. see eachPath function

Path.recurFilePath(filePath=>console.log('file', filePath))

String Manipulations

var PathTest = require('ack-path')('/test/file.js')

PathTest.removeExt().path == "/test/file"
PathTest.removeFile().path == "/test/"

SYNC Examples

.sync().require

var PathSync = require('ack-path')(__dirname).sync()
var pathTo = PathSync.path

.sync().dirExists()

considers if path is actually a file

PathSync.dirExists()

.sync().exists()

PathSync.exists()

.sync().delete()

PathSync.delete()

.sync().copyTo()

PathSync.copyTo()

File Functionality

A more file specific set of objective functionality

require.file

var File = require('ack-path')(__dirname).file('file-name.js')
var filePath = File.path

.file().delete()

File.delete().then()

.file().getMimeType()

File.getMimeType()//Ex: application/javascript

.file().stat()

File.stat().then(stats=>stats.size)

.file().write()

File.write(string).then()

.file().append()

File.append(string).then()

.file().readJson()

File.readJson().then()

Keywords

FAQs

Last updated on 02 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc