Coder Social home page Coder Social logo

sclu1034 / lgi-async-extra Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 504 KB

Asynchronous high(er)-level API wrapper for LGI

Home Page: https://sclu1034.github.io/lgi-async-extra/

License: GNU General Public License v3.0

Lua 99.36% Shell 0.64%
async glib lgi lua

lgi-async-extra's People

Contributors

bors[bot] avatar sclu1034 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kasper24

lgi-async-extra's Issues

Add function to create file links

This will require adding the relevant functions to GLib first:

g_file_make_symbolic_link_async
g_file_make_symbolic_link_finish
g_file_make_hard_link_async
g_file_make_hard_link_finish

The synchronous g_file_make_symbolic_link already exists, but GLib does not yet support creating hard links at all.

The Lua wrapper should be rather straight forward. The signature should be

-- @async
-- @tparam string target The target to point the link to.
-- @tparam[opt=true] boolean symbolic If `true`, create a symbolic link.
-- @treturn[opt] GLib.Error
function File:link(target, symbolic, cb)
end

Implement reading an entire string into raw bytes

Gio's stream operations to read arbitrary binary content return GBytes, which are immutable. To be able to read an entire stream, a GByteArray or similar mutable storage would be needed.
However, g_byte_array_append is not available via introspection (likely because the lower-level GArray operations aren't available either), making it impossible to push multiple GBytes into a single array.
LGI does have a rudimentary byte array available as require("bytes"), but this one doesn't allow efficient modification either. __newindex is implemented, but setting individual indices for buffer sizes of 4096 bytes would be rather inefficient.

Work on implementing a wrapper for GByteArray was started in https://github.com/sclu1034/lgi-async-extra/tree/feature/bytearray, but this would require linking against LGI and figuring out its inner workings.

It would be much better if LGI's bytes module was improved or GLib's arrays somehow became introspectable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.