SHARE
TWEET

mkdir for MegaFS

a guest Feb 4th, 2013 98 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top