Next: , Previous: , Up: API  


1.2 (kracht io)

1.2.1 Procedures

Procedure: build-asset-library files

Asset library is an in-memory cache, a lookup dictionary that can be used for faster performance, memoization, etc. This version will read from a list of files specified with the FILES param.

To use it, you can simply call the function with a list of file paths.

Procedure: get-short-commit-sha KEY: #:default

Retrieve the short Git commit SHA (7 characters) of the current repository state, with surrounding whitespace trimmed. If no SHA can be determined (for example outside of a Git repository), return DEFAULT.

Procedure: get-string-all port

Undocumented procedure.

Procedure: getenv-or var KEY: #:default

Get env VAR or return a DEFAULT value.

Procedure: open-input-output-pipe command

Equivalent to open-pipe with mode OPEN_BOTH

Procedure: open-input-pipe command

Equivalent to open-pipe with mode OPEN_READ

Procedure: read-file-string path

Read the entire contents of the file at PATH and return it as a string. The input port is always closed, even if an error is raised while reading.

Procedure: syscall cmd

Execute system shell command CMD via an input pipe and return the captured standard output as a string.

Procedure: with-output-to-file file thunk KEY: #:binary #:encoding

THUNK must be a procedure of no arguments, and FILE must be a string naming a file. The effect is unspecified if the file already exists. The file is opened for output, an output port connected to it is made the default value returned by ‘current-output-port’, and the THUNK is called with no arguments. When the THUNK returns, the port is closed and the previous default is restored. Returns the values yielded by THUNK. If an escape procedure is used to escape from the continuation of these procedures, their behavior is implementation dependent.

Procedure: with-output-to-port port thunk

Undocumented procedure.

Procedure: with-output-to-string thunk

Calls THUNK and returns its output as a string.

Procedure: write-file-string path contents

Write the string CONTENTS to the file at PATH, replacing any previous contents. Returns the number of characters written.


Next: (kracht lists), Previous: (kracht html-entities), Up: API