-api-id | -api-type |
---|---|
M:Windows.Storage.PathIO.ReadTextAsync(System.String) |
winrt method |
Reads the contents of the file at the specified path or Uniform Resource Identifier (URI) and returns text.
The path of the file to read.
When this method completes successfully, it returns the contents of the file as a text string.
This example shows you how to use readTextAsync(absolutePath) to read text from the file at the path in absoluteFilePath
like this:
Windows.Storage.PathIO.readTextAsync(absoluteFilePath).then(function (contents) {
// Add code to process the text read from the file
});
You can use then or done to declare a function to capture and process the text that was read from the file. After the readTextAsync method completes, the text will be passed to this function as a string object (contents
in the example).