Guest User

mkdir for MegaFS

a guest
Feb 4th, 2013
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##### megaclient.py
  2.     def createdir(self, target, dirname):
  3.         key =  [random.randint(0, 0xFFFFFFFF) for _ in xrange(4)]
  4.         attributes = {'n': dirname}
  5.         enc_attributes = enc_attr(attributes, key)
  6.         return self.api_req({'a': 'p', 't': target, 'n': [{'h': 'xxxxxxxx', 't': 1, 'a': base64urlencode(enc_attributes), 'k': a32_to_base64(encrypt_key(key, self.master_key))}]})
  7. ##### megaclient.py
  8.  
  9.  
  10. ##### megafs.py
  11.     def mkdir (self, path, mode):
  12.         dirname, basename = os.path.split(path)
  13.         created_folder = self.client.createdir(self.files[dirname]['h'], basename)
  14.         if 'f' in created_folder:
  15.             created_folder = self.client.processfile(created_folder['f'][0])
  16.             self.files[dirname]['children'].append(basename)
  17.             self.files[path] = created_folder
  18.             self.files[path]['children'] = []
  19. ##### megafs.py
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×