Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <h1>
  2. <img src="https://raw.githubusercontent.com/vfile/vfile/7e1e6a6/logo.svg?sanitize=true" alt="vfile" width="400" />
  3. </h1>
  4. [![Build][build-badge]][build]
  5. [![Coverage][coverage-badge]][coverage]
  6. [![Downloads][downloads-badge]][downloads]
  7. [![Size][size-badge]][size]
  8. [![Sponsors][sponsors-badge]][collective]
  9. [![Backers][backers-badge]][collective]
  10. [![Chat][chat-badge]][chat]
  11. **vfile** is a small and browser friendly virtual file format that tracks
  12. metadata (such as a file’s `path` and `contents`) and [messages][].
  13. It was made specifically for **[unified][]** and generally for the common task
  14. of parsing, transforming, and serializing data, where `vfile` handles everything
  15. about the document being compiled.
  16. This is useful for example when building linters, compilers, static site
  17. generators, or other build tools.
  18. **vfile** is part of the [unified collective][site].
  19. * for updates, see [Twitter][]
  20. * for more about us, see [`unifiedjs.com`][site]
  21. * for questions, see [Discussions][chat]
  22. * to help, see [contribute][] or [sponsor][] below
  23. > **vfile** is different from the excellent [`vinyl`][vinyl] in that it has
  24. > a smaller API, a smaller size, and focuses on [messages][].
  25. ## Contents
  26. * [Install](#install)
  27. * [Use](#use)
  28. * [API](#api)
  29. * [`VFile(options?)`](#vfileoptions)
  30. * [`vfile.contents`](#vfilecontents)
  31. * [`vfile.cwd`](#vfilecwd)
  32. * [`vfile.path`](#vfilepath)
  33. * [`vfile.basename`](#vfilebasename)
  34. * [`vfile.stem`](#vfilestem)
  35. * [`vfile.extname`](#vfileextname)
  36. * [`vfile.dirname`](#vfiledirname)
  37. * [`vfile.history`](#vfilehistory)
  38. * [`vfile.messages`](#vfilemessages)
  39. * [`vfile.data`](#vfiledata)
  40. * [`VFile#toString(encoding?)`](#vfiletostringencoding)
  41. * [`VFile#message(reason[, position][, origin])`](#vfilemessagereason-position-origin)
  42. * [`VFile#info(reason[, position][, origin])`](#vfileinforeason-position-origin)
  43. * [`VFile#fail(reason[, position][, origin])`](#vfilefailreason-position-origin)
  44. * [List of utilities](#list-of-utilities)
  45. * [Reporters](#reporters)
  46. * [Contribute](#contribute)
  47. * [Sponsor](#sponsor)
  48. * [Acknowledgments](#acknowledgments)
  49. * [License](#license)
  50. ## Install
  51. [npm][]:
  52. ```sh
  53. npm install vfile
  54. ```
  55. ## Use
  56. ```js
  57. var vfile = require('vfile')
  58. var file = vfile({path: '~/example.txt', contents: 'Alpha *braavo* charlie.'})
  59. file.path // => '~/example.txt'
  60. file.dirname // => '~'
  61. file.extname = '.md'
  62. file.basename // => 'example.md'
  63. file.basename = 'index.text'
  64. file.history // => ['~/example.txt', '~/example.md', '~/index.text']
  65. file.message('`braavo` is misspelt; did you mean `bravo`?', {
  66. line: 1,
  67. column: 8
  68. })
  69. console.log(file.messages)
  70. ```
  71. Yields:
  72. ```js
  73. [ { [~/index.text:1:8: `braavo` is misspelt; did you mean `bravo`?]
  74. message: '`braavo` is misspelt; did you mean `bravo`?',
  75. name: '~/index.text:1:8',
  76. file: '~/index.text',
  77. reason: '`braavo` is misspelt; did you mean `bravo`?',
  78. line: 1,
  79. column: 8,
  80. location: { start: [Object], end: [Object] },
  81. ruleId: null,
  82. source: null,
  83. fatal: false } ]
  84. ```
  85. ## API
  86. ### `VFile(options?)`
  87. Create a new virtual file.
  88. If `options` is `string` or `Buffer`, treats it as `{contents: options}`.
  89. If `options` is a `VFile`, returns it.
  90. All other options are set on the newly created `vfile`.
  91. Path related properties are set in the following order (least specific to most
  92. specific): `history`, `path`, `basename`, `stem`, `extname`, `dirname`.
  93. It’s not possible to set either `dirname` or `extname` without setting either
  94. `history`, `path`, `basename`, or `stem` as well.
  95. ###### Example
  96. ```js
  97. vfile()
  98. vfile('console.log("alpha");')
  99. vfile(Buffer.from('exit 1'))
  100. vfile({path: path.join(__dirname, 'readme.md')})
  101. vfile({stem: 'readme', extname: '.md', dirname: __dirname})
  102. vfile({other: 'properties', are: 'copied', ov: {e: 'r'}})
  103. ```
  104. ### `vfile.contents`
  105. `Buffer`, `string`, `null` — Raw value.
  106. ### `vfile.cwd`
  107. `string` — Base of `path`.
  108. Defaults to `process.cwd()`.
  109. ### `vfile.path`
  110. `string?` — Path of `vfile`.
  111. Cannot be nullified.
  112. ### `vfile.basename`
  113. `string?` — Current name (including extension) of `vfile`.
  114. Cannot contain path separators.
  115. Cannot be nullified either (use `file.path = file.dirname` instead).
  116. ### `vfile.stem`
  117. `string?` — Name (without extension) of `vfile`.
  118. Cannot be nullified, and cannot contain path separators.
  119. ### `vfile.extname`
  120. `string?` — Extension (with dot) of `vfile`.
  121. Cannot be set if there’s no `path` yet and cannot contain path separators.
  122. ### `vfile.dirname`
  123. `string?` — Path to parent directory of `vfile`.
  124. Cannot be set if there’s no `path` yet.
  125. ### `vfile.history`
  126. `Array.<string>` — List of file-paths the file moved between.
  127. ### `vfile.messages`
  128. [`Array.<VMessage>`][message] — List of messages associated with the file.
  129. ### `vfile.data`
  130. `Object` — Place to store custom information.
  131. It’s OK to store custom data directly on the `vfile`, moving it to `data` gives
  132. a *little* more privacy.
  133. ### `VFile#toString(encoding?)`
  134. Convert contents of `vfile` to string.
  135. When `contents` is a [`Buffer`][buffer], `encoding` is a
  136. [character encoding][encoding] to understand `doc` as (`string`, default:
  137. `'utf8'`).
  138. ### `VFile#message(reason[, position][, origin])`
  139. Associates a message with the file, where `fatal` is set to `false`.
  140. Constructs a new [`VMessage`][vmessage] and adds it to
  141. [`vfile.messages`][messages].
  142. ##### Returns
  143. [`VMessage`][vmessage].
  144. ### `VFile#info(reason[, position][, origin])`
  145. Associates an informational message with the file, where `fatal` is set to
  146. `null`.
  147. Calls [`#message()`][message] internally.
  148. ##### Returns
  149. [`VMessage`][vmessage].
  150. ### `VFile#fail(reason[, position][, origin])`
  151. Associates a fatal message with the file, then immediately throws it.
  152. Note: fatal errors mean a file is no longer processable.
  153. Calls [`#message()`][message] internally.
  154. ##### Throws
  155. [`VMessage`][vmessage].
  156. <a name="utilities"></a>
  157. ## List of utilities
  158. The following list of projects includes tools for working with virtual files.
  159. See **[unist][]** for projects that work with nodes.
  160. * [`convert-vinyl-to-vfile`](https://github.com/dustinspecker/convert-vinyl-to-vfile)
  161. — transform from [Vinyl][] to vfile
  162. * [`to-vfile`](https://github.com/vfile/to-vfile)
  163. — create a vfile from a filepath
  164. * [`vfile-find-down`](https://github.com/vfile/vfile-find-down)
  165. — find files by searching the file system downwards
  166. * [`vfile-find-up`](https://github.com/vfile/vfile-find-up)
  167. — find files by searching the file system upwards
  168. * [`vfile-glob`](https://github.com/shinnn/vfile-glob)
  169. — find files by glob patterns
  170. * [`vfile-is`](https://github.com/vfile/vfile-is)
  171. — check if a vfile passes a test
  172. * [`vfile-location`](https://github.com/vfile/vfile-location)
  173. — convert between positional and offset locations
  174. * [`vfile-matter`](https://github.com/vfile/vfile-matter)
  175. — parse the YAML front matter
  176. * [`vfile-message`](https://github.com/vfile/vfile-message)
  177. — create a vfile message
  178. * [`vfile-messages-to-vscode-diagnostics`](https://github.com/shinnn/vfile-messages-to-vscode-diagnostics)
  179. — transform vfile messages to VS Code diagnostics
  180. * [`vfile-mkdirp`](https://github.com/vfile/vfile-mkdirp)
  181. — make sure the directory of a vfile exists on the file system
  182. * [`vfile-rename`](https://github.com/vfile/vfile-rename)
  183. — rename the path parts of a vfile
  184. * [`vfile-sort`](https://github.com/vfile/vfile-sort)
  185. — sort messages by line/column
  186. * [`vfile-statistics`](https://github.com/vfile/vfile-statistics)
  187. — count messages per category: failures, warnings, etc
  188. * [`vfile-to-eslint`](https://github.com/vfile/vfile-to-eslint)
  189. — convert to ESLint formatter compatible output
  190. ## Reporters
  191. The following list of projects show linting results for given virtual files.
  192. Reporters *must* accept `Array.<VFile>` as their first argument, and return
  193. `string`.
  194. Reporters *may* accept other values too, in which case it’s suggested to stick
  195. to `vfile-reporter`s interface.
  196. * [`vfile-reporter`][reporter]
  197. — create a report
  198. * [`vfile-reporter-json`](https://github.com/vfile/vfile-reporter-json)
  199. — create a JSON report
  200. * [`vfile-reporter-folder-json`](https://github.com/vfile/vfile-reporter-folder-json)
  201. — create a JSON representation of vfiles
  202. * [`vfile-reporter-pretty`](https://github.com/vfile/vfile-reporter-pretty)
  203. — create a pretty report
  204. * [`vfile-reporter-junit`](https://github.com/kellyselden/vfile-reporter-junit)
  205. — create a jUnit report
  206. * [`vfile-reporter-position`](https://github.com/Hocdoc/vfile-reporter-position)
  207. — create a report with content excerpts
  208. ## Contribute
  209. See [`contributing.md`][contributing] in [`vfile/.github`][health] for ways to
  210. get started.
  211. See [`support.md`][support] for ways to get help.
  212. Ideas for new utilities and tools can be posted in [`vfile/ideas`][ideas].
  213. This project has a [code of conduct][coc].
  214. By interacting with this repository, organization, or community you agree to
  215. abide by its terms.
  216. ## Sponsor
  217. Support this effort and give back by sponsoring on [OpenCollective][collective]!
  218. <table>
  219. <tr valign="middle">
  220. <td width="20%" align="center" colspan="2">
  221. <a href="https://www.gatsbyjs.org">Gatsby</a> 🥇<br><br>
  222. <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a>
  223. </td>
  224. <td width="20%" align="center" colspan="2">
  225. <a href="https://vercel.com">Vercel</a> 🥇<br><br>
  226. <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a>
  227. </td>
  228. <td width="20%" align="center" colspan="2">
  229. <a href="https://www.netlify.com">Netlify</a><br><br>
  230. <!--OC has a sharper image-->
  231. <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a>
  232. </td>
  233. <td width="10%" align="center">
  234. <a href="https://www.holloway.com">Holloway</a><br><br>
  235. <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a>
  236. </td>
  237. <td width="10%" align="center">
  238. <a href="https://themeisle.com">ThemeIsle</a><br><br>
  239. <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a>
  240. </td>
  241. <td width="10%" align="center">
  242. <a href="https://boosthub.io">Boost Hub</a><br><br>
  243. <a href="https://boosthub.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a>
  244. </td>
  245. <td width="10%" align="center">
  246. <a href="https://expo.io">Expo</a><br><br>
  247. <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a>
  248. </td>
  249. </tr>
  250. <tr valign="middle">
  251. <td width="100%" align="center" colspan="10">
  252. <br>
  253. <a href="https://opencollective.com/unified"><strong>You?</strong></a>
  254. <br><br>
  255. </td>
  256. </tr>
  257. </table>
  258. ## Acknowledgments
  259. The initial release of this project was authored by
  260. [**@wooorm**](https://github.com/wooorm).
  261. Thanks to [**@contra**](https://github.com/contra),
  262. [**@phated**](https://github.com/phated), and others for their work on
  263. [Vinyl][], which was a huge inspiration.
  264. Thanks to
  265. [**@brendo**](https://github.com/brendo),
  266. [**@shinnn**](https://github.com/shinnn),
  267. [**@KyleAMathews**](https://github.com/KyleAMathews),
  268. [**@sindresorhus**](https://github.com/sindresorhus), and
  269. [**@denysdovhan**](https://github.com/denysdovhan)
  270. for contributing commits since!
  271. ## License
  272. [MIT][license] © [Titus Wormer][author]
  273. <!-- Definitions -->
  274. [build-badge]: https://github.com/vfile/vfile/workflows/main/badge.svg
  275. [build]: https://github.com/vfile/vfile/actions
  276. [coverage-badge]: https://img.shields.io/codecov/c/github/vfile/vfile.svg
  277. [coverage]: https://codecov.io/github/vfile/vfile
  278. [downloads-badge]: https://img.shields.io/npm/dm/vfile.svg
  279. [downloads]: https://www.npmjs.com/package/vfile
  280. [size-badge]: https://img.shields.io/bundlephobia/minzip/vfile.svg
  281. [size]: https://bundlephobia.com/result?p=vfile
  282. [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
  283. [backers-badge]: https://opencollective.com/unified/backers/badge.svg
  284. [collective]: https://opencollective.com/unified
  285. [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
  286. [chat]: https://github.com/vfile/vfile/discussions
  287. [npm]: https://docs.npmjs.com/cli/install
  288. [contributing]: https://github.com/vfile/.github/blob/HEAD/contributing.md
  289. [support]: https://github.com/vfile/.github/blob/HEAD/support.md
  290. [health]: https://github.com/vfile/.github
  291. [coc]: https://github.com/vfile/.github/blob/HEAD/code-of-conduct.md
  292. [license]: license
  293. [author]: https://wooorm.com
  294. [unified]: https://github.com/unifiedjs/unified
  295. [vinyl]: https://github.com/gulpjs/vinyl
  296. [site]: https://unifiedjs.com
  297. [twitter]: https://twitter.com/unifiedjs
  298. [contribute]: #contribute
  299. [sponsor]: #sponsor
  300. [unist]: https://github.com/syntax-tree/unist#list-of-utilities
  301. [reporter]: https://github.com/vfile/vfile-reporter
  302. [vmessage]: https://github.com/vfile/vfile-message
  303. [messages]: #vfilemessages
  304. [message]: #vfilemessagereason-position-origin
  305. [ideas]: https://github.com/vfile/ideas
  306. [encoding]: https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
  307. [buffer]: https://nodejs.org/api/buffer.html