object IOUtils
- Alphabetic
- By Inheritance
- IOUtils
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
def
extension(path: String): Option[String]
Get an extension on a file or None.
-
def
fexists(path: String): Boolean
Returns true if the file exists, false otherwise.
Returns true if the file exists, false otherwise. Synchronous.
-
def
filename(path: String): Option[String]
Get the filename (base + ext) if it exists.
-
def
fromBase64(s: String): Buffer
Convert string from base64.
-
def
getPostfix(path: String): Option[String]
Get the extension/postfix on a filename less the preceeding ".".
-
def
namepart(path: String): Option[String]
Get the base(name) + extension.
-
def
pathjoin(lhs: String, rhs: String): String
Join two path segments.
-
def
pprint(o: Dynamic): String
Pretty print a js.Dynamic object.
-
def
pprint(o: Object, opts: InspectOptions = ...): String
Pretty print a js.Object
-
def
render(o: Any, opts: InspectOptions = ...): String
Render a js.Any into a string using nodejs Inspect.
-
def
slurp(file: String, encoding: String = "utf8"): String
Slurp a file as a utf8 string, synchronous, full read into memory.
-
def
slurpAsBase64(file: String): String
Slurp a file as a base64 encoded string.
Slurp a file as a base64 encoded string. Good for json upload bodies. Synchronous
-
def
slurpAsJson[T](file: String, reviver: Option[Reviver] = None, encoding: String = "utf8"): T
Slurp a file as JSON and cast.
Slurp a file as JSON and cast. No exception handling is provided. Synchronous.
-
def
writeToFile(path: String, content: |[String, Buffer])(implicit ec: ExecutionContext): IO[Unit]
Async write content to file creating paths if path contains path segments that do not exist.
Async write content to file creating paths if path contains path segments that do not exist.
- path
Path name, both path and file.
- content
String content.
- returns
Unit if file written, otherwise a failed IO.
-
def
writeToFileSync(path: String, content: |[String, Buffer]): Unit
Write to file synchronously.