summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-05-24 00:09:54 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-05-24 00:09:54 +0200
commitfcb5cdcc9ff2e8e1aa9dec5c665efa35b9931b03 (patch)
tree8c7c4f3b5294c611966a5bbdd101e39bf148b71a /lib
parente00f15aa2a0843afbf204157b0b93f8de2bae3ba (diff)
parent807784db826f4718c800e0554c834fbbddfecce7 (diff)
downloadNim-fcb5cdcc9ff2e8e1aa9dec5c665efa35b9931b03.tar.gz
Merge pull request #4083 from vegansk/vm_readfile
Add ``readFile`` implementation for nimvm
Diffstat (limited to 'lib')
-rw-r--r--lib/system.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index cb98bcc5f..604992969 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2628,6 +2628,14 @@ when not defined(JS): #and not defined(nimscript):
       else: result = 0
 
   when defined(nimscript):
+    proc readFile*(filename: string): string {.tags: [ReadIOEffect], benign.}
+      ## Opens a file named `filename` for reading.
+      ##
+      ## Then calls `readAll <#readAll>`_ and closes the file afterwards.
+      ## Returns the string.  Raises an IO exception in case of an error. If
+      ## you need to call this inside a compile time macro you can use
+      ## `staticRead <#staticRead>`_.
+
     proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.}
       ## Opens a file named `filename` for writing. Then writes the
       ## `content` completely to the file and closes the file afterwards.